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:…