Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-Selenium返回带所有方法的空结果_Python_Django_Selenium - Fatal编程技术网

Python-Selenium返回带所有方法的空结果

Python-Selenium返回带所有方法的空结果,python,django,selenium,Python,Django,Selenium,以前有人问过这个问题,但似乎没有一个能解决我的问题 我尝试在中查找元素,但尝试失败: 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_

以前有人问过这个问题,但似乎没有一个能解决我的问题

我尝试在中查找元素,但尝试失败:

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()  
我也不能从这个页面上刮取任何其他数据(按id、按名称、按类名、按css选择器),所有数据都返回空文本

我们欢迎您的任何建议或反馈,并将不胜感激

谢谢大家!

尝试更换:

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

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