skip to Main Content

The result of the xpath expression "html/body/div/text()[1]" is: [object Text]. It should be an element error printing element text using Selenium

I'm attempting to extract "479" from this sample HTML: <div data-testid="testid"> "479" " Miles Away" </div> I'm using the following Selenium code in Python: xpath = 'html/body/div/text()[1]' WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.XPATH, xpath))) distance = driver.find_element(By.XPATH, xpath) print(distance) Which returns the following error:…

VIEW QUESTION

Testcontainers exception on startup – Docker

Does anyone know why I sometimes get exception when I use Selenium together with Testcontainers. See below: Exception has occurred: CLR/OpenQA.Selenium.WebDriverException An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code: 'An unknown exception was…

VIEW QUESTION

Selenium WebDriver crashes when I try to get innerText from an element container – Telegram API

I am trying to get the innerText from all themessage.spoilers-container, but when I scroll up the webpage, the program crashes, and give me an error. Code: from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys def find_message_container(driver):…

VIEW QUESTION
Back To Top
Search