I am having some difficulties with a relative XPath web scraper implementation with Selenium for Python.
From this Börse Frankfurt web page, I want to get the text in the cell adjacent to <td> UCITS IV-Konform </td>, namely the text in the cell that says <td class="text-right"> Ja </td>.
I have tested the XPath I'm using with Freeformatter which states that my XPath is correct.
Navigation to the page works fine. However, when I try to retrieve the text content, I get None.
I'm not sure if this is a XPath problem or if the issue lies in its implementation, so I'm providing the relevant Python code below. What could be the problem?
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException driver = webdriver.Firefox() driver.get("http://www.boerse-frankfurt.de/etp/db-x-trackers-STOXX-GLOBAL-SELECT-DIVIDEND-100-UCITS-ETF-1D-LU0292096186") try: find_value = driver.find_element_by_xpath("//td[text()=' UCITS IV-Konform ']/following-sibling::td").text except NoSuchElementException: find_value = None print find_value
No comments:
Post a Comment