I am using selenium (java API) to automate testing of a page with a d3.js visualization. I need to find some data point in a chart (svg).
The screenshot of my Chrome console is probably be the clearest way to explain my problem:
My element has a data property (__data__.key
) that is not in HTML.
In JavaScript, I can simply get the property by <element>.__data__.key
.
But in Selenium, I wasn't able to retrieve it (e.g. by using getProperty
).
Any suggestions?
I will solve it using python but similar methods are available in javascript too.
Two scenarios available:
page_source
() propertyinnerHtml
attributeBoth approaches interact with DOM that is loaded later on via AJAX, provided you access it at the right time. Once you get the DOM source of the page you can implement the checks you need.
page_source
or
innerHtml