Thursday 4 May 2017

How do I get HTML Element property using WebDriver for nodejs

I'm trying to test a d3 visualization using webdriver.io. d3 binds data to elements using a data property. I can select the element fine but don't see how I access this property.

In the chrome console I see data object with:

document.querySelector('#myelement').__data__;

I've tried:

var data = browser.execute("document.querySelector('#myelement').__data__")

This returns the Web Element JSON Object.

as does:

var ele = browser.element('#myelement');
ele.getAttribute('__data__');

This question gives options for Python and Java but doesn't seem to work on nodejs. Getting an (d3) element's property that is in DOM, not in the HTML, with Selenium



via tom eustace

No comments:

Post a Comment