0

Error while running my Selenium automation

I cannot completely run my project as it is shown error soon after rendering the web.whatsapp.com

This is my code

from selenium import webdriver 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.common.by import By 
import time 

driver = webdriver.Chrome('chromedriver.exe') 

driver.get("https://web.whatsapp.com/") 
wait = WebDriverWait(driver, 600) 

target = '"D@D"'

string = "Message sent using Python!!!"

x_arg = '//span[contains(@title,' + target + ')]'
group_title = wait.until(EC.presence_of_element_located(( 
    By.XPATH, x_arg))) 
group_title.click() 
inp_xpath = '//div[@class="input"][@dir="auto"][@data-tab="1"]'
input_box = wait.until(EC.presence_of_element_located(( 
    By.XPATH, inp_xpath))) 
for i in range(100): 
    input_box.send_keys(string + Keys.ENTER) 
    time.sleep(1) 

Following are the errors :/

DevTools listening on ws://127.0.0.1:7568/devtools/browser/4166a9d5-5e52-4d35-98da-769f457998e7
[17452:12364:1123/234409.011:ERROR:device_event_log_impl.cc(211)] [23:44:09.012] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node 
connection: A device attached to the system is not functioning. (0x1F)
[17452:12364:1123/234409.041:ERROR:device_event_log_impl.cc(211)] [23:44:09.041] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node 
connection: A device attached to the system is not functioning. (0x1F)

Cannot find any other solutions on web

Thank You

Adarsh Mamgain
  • 153
  • 1
  • 7

1 Answers1

0

I see that you are doing the below:

driver = webdriver.Chrome('chromedriver.exe')

Use the below if you dont want to specify the location because you might not now where it is at:

driver = webdriver.Chrome()

Is your chrome in your D, F, etc... drive?

Example:

driver = webdriver.Chrome("F:\\chromedriver.exe")

Vaclemor
  • 45
  • 7
  • That should give a different error. Something about `chromedriver` not being in PATH – Abhishek Rai Nov 23 '20 at 18:39
  • This error can be ignored but in most cases, the webdriver isn't pathing correctly. I found a similar thread: https://stackoverflow.com/questions/64927909/failed-to-read-descriptor-from-node-connection-a-device-attached-to-the-system – Vaclemor Nov 23 '20 at 19:06