0

This has been asked before but none seems to solve my issue.

I try to locate an element in this page, but fail at my attempts:

driver = webdriver.Chrome()
driver.set_window_size(0, 0)
driver.set_window_position(0, 0)
url = "https://www.autotrader.com/cars-for-sale/2003/Aston+Martin/DB7"
driver.get(url)
print (driver.find_element_by_xpath("//span[@data-qaid='txt-lowest-price']").text)
driver.close()  

I can not scrape any other data from this page either (by_id, by_name, by_class_name, by_css_selector), all returning empty texts.

Any suggestion or feedback will be welcomed and greatly appreciated.

Thank you!

1 Answer 1

1

try replacing:

driver.find_element_by_xpath("//span[@data-qaid='txt-lowest-price']").text

with:

driver.find_element_by_xpath("//span[@data-qaid='txt-lowest-price']").get_attribute('textContent')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.