Returning a DOM element with Webdriver in Javascript -


how return dom element webdriver in javascript?

i using wd.js javascript bindings:

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

i getting weird object not standard dom element (for example cannot 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' } } 

it impossible actual javascript dom element webdriver client, should no problem cases since method getattribute() available. example:

require("wd")   .remote("promisechain")   .init()   .get("http://www.google.com")   .elementbyid("mngb")   .getattribute("outerhtml")   .then(console.log.bind(console)) 

returns html code #mngb on www.google.com

in case using dom element needed, 1 can create copy using jsdom


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -