【发布时间】:2021-01-14 23:13:44
【问题描述】:
我正在使用 selenium webdriver 从这个 http://proxydb.net/?protocol=socks4&country=BD 中抓取代理地址。但是在尝试从表中抓取数据时,我得到了 "None" 。这是我的代码::
from selenium import webdriver
browser = webdriver.Chrome()
browser.get(
'http://proxydb.net/?protocol=socks4&country=BD')
String = browser.find_element_by_xpath("//table/tbody/tr[1]/td[1]")
print(String.get_attribute('text'))
browser.quit()
这是输出:
C:\Users\Asus\Documents\Hello World>python -u "c:\Users\Asus\Documents\Hello World\Web Scraping\proxy\proxy1.py"
DevTools listening on ws://127.0.0.1:56478/devtools/browser/215c65c4-d3c5-4653-85c1-1f63ccde50ba
[36844:7508:0115/050206.852:ERROR:device_event_log_impl.cc(211)] [05:02:06.852] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[36844:7508:0115/050206.854:ERROR:device_event_log_impl.cc(211)] [05:02:06.854] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[36844:7508:0115/050206.870:ERROR:device_event_log_impl.cc(211)] [05:02:06.869] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
None
这里,为什么我会得到这个
[36844:7508:0115/050206.852:ERROR:device_event_log_impl.cc(211)] [05:02:06.852] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) ?
以及如何解决这个“无”问题?
【问题讨论】:
标签: python-3.x selenium xpath webdriver