Unable To Read Text From A Div Tag In Python
for position in driver.find_elements_by_xpath('//div[@class='d3-tip n']'): style = position.get_attribute('style') opacity = style[:
Solution 1:
You can just get the first div
out of 2 found found by the class name:
element = driver.find_elements_by_xpath('//div[@class="d3-tip n"]')[0]
print element.text
Another option is to check that there are no children in the div
tag:
element = driver.find_element_by_xpath('//div[@class="d3-tip n"][count(*)=0]')
print element.text
Another option is to check that there is select
text inside the div
text:
element = driver.find_element_by_xpath('//div[@class="d3-tip n"][contains(text(), "select")]')
print element.text
Post a Comment for "Unable To Read Text From A Div Tag In Python"