Reputation:
I tried to extract data the site below with selenium library but Unfortunately I got next error. is there anyone who can help me??
from selenium import webdriver
url = 'https://www150.statcan.gc.ca/n1/pub/71-607-x/2021004/exp-eng.htm?r1=(1)&r2=0&r3=0&r4=12&r5=0&r7=0&r8=2022-02-01&r9=2022-02-011'
driver = webdriver.Chrome()
driver.get(url)
table = driver.find_elements_by_class_name('data')
for table1 in table:
value = table1.find_element_by_xpath('.//*[@id="report_table"]/tbody/tr[1]/td[6]').text
quantity = table1.find_element_by_xpath('.//*[@id="report_table"]/tbody/tr[1]/td[7]').text
unit = table1.find_element_by_xpath('.//*[@id="report_table"]/tbody/tr[1]/td[8]').text
print(value, quantity, quantity)
the Error is:
enter image description herePS C:\Users\asus\Desktop\home> [840:7000:0417/201023.654:ERROR:device_event_log_impl.cc(214)] [20:10:23.656] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[840:7000:0417/201023.654:ERROR:device_event_log_impl.cc(214)] [20:10:23.658] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[840:7000:0417/201023.654:ERROR:device_event_log_impl.cc(214)] [20:10:23.659] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[840:7000:0417/201023.659:ERROR:device_event_log_impl.cc(214)] [20:10:23.660] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[840:16136:0417/201113.924:ERROR:util.cc(126)] Can't create base directory: C:\Program Files\Google\GoogleUpdater
Upvotes: 4
Views: 14417
Reputation: 51
Just create the directory manually: "C:\Program Files\Google\GoogleUpdater". Should work properly.
Upvotes: 3
Reputation: 53
I think you should link to your webDriver using its path if you haven't already
driver = webdriver.Chrome("your WebDriver Path")
Upvotes: 0