Returning a DOM element with Webdriver in Javascript

Posted by ehmicky on Stack Overflow See other posts from Stack Overflow or by ehmicky
Published on 2014-06-07T20:54:45Z Indexed on 2014/06/07 21:24 UTC
Read the original article Hit count: 349

How do I return a DOM Element with Webdriver in Javascript?

I am using the wd.js Javascript bindings:

require("wd")
  .remote("promiseChain")
  .init()
  .get("http://www.google.com")
  .elementById("mngb")
  .then(function(element) { console.log(element); });

I am getting this weird object that is not a standard DOM Element (for example I cannot get the HTML code out of it):

{ value: '0',
  browser: 
  { domain: null,
    _events: {},
    _maxListeners: 10,
    configUrl: 
  { protocol: 'http:',
    slashes: true,
    auth: null,
    host: '127.0.0.1:4444',
    port: '4444',
    hostname: '127.0.0.1',
    hash: null,
    search: '',
    query: {},
    pathname: '/wd/hub',
    path: '/wd/hub',
    href: 'http://127.0.0.1:4444/wd/hub' },
 sauceRestRoot: 'https://saucelabs.com/rest/v1',
 noAuthConfigUrl: 
  { protocol: 'http:',
    slashes: true,
    host: '127.0.0.1:4444',
    port: '4444',
    hostname: '127.0.0.1',
    hash: null,
    search: null,
    query: null,
    pathname: '/wd/hub',
    path: '/wd/hub',
    href: 'http://127.0.0.1:4444/wd/hub' },
 defaultCapabilities: 
  { browserName: 'firefox',
    version: '',
    javascriptEnabled: true,
    platform: 'ANY' },
 _httpConfig: 
  { timeout: undefined,
    retries: 3,
    retryDelay: 15,
    baseUrl: undefined },
 sampleElement: { value: 1, browser: [Circular] },
 sessionID: '238c9837-3d82-4d90-9594-cefb4ba8e6b9' } }

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom