Getting An (d3) Element's Property That Is In DOM, Not In The HTML, With Selenium
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 pro
Solution 1:
I will solve it using python but similar methods are available in javascript too.
Two scenarios available:
page_source
() propertyinnerHtml
attribute
Both 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
driver.get(url)
time.sleep(3)
source = driver.page_source
print source
or
innerHtml
driver.get(url)
time.sleep(3)
elem = self.driver.find_element_by_xpath("//*")
source = elem.get_attribute("innerHTML")
print source
Post a Comment for "Getting An (d3) Element's Property That Is In DOM, Not In The HTML, With Selenium"