from selenium import webdriver
chromedriver = "/Users/ROJA/Downloads/chromedriver"
driver = webdriver.Chrome(chromedriver)
driver.get('
https://web.whatsapp.com/')
name = input('Enter the name of user or group : ')
msg = input('Enter your message : ')
count = int(input('Enter the count : '))
input('Enter anything after scanning QR code')
#ths is an error
user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
user.click()
msg_box = driver.find_element_by_class_name('wjdTm')
for i in range(count):
msg_box.send_keys(msg)
button = driver.find_element_by_class_name('_3M-N-')
button.click()
this is a output :
Enter the name of user or group : Bp
Enter your message : ur hacked
Enter the count : 50
Enter anything after scanning QR code
Traceback (most recent call last):
File "automation.py", line 87, in <module>
user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
File "C:\Users\ROJA\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\ROJA\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Users\ROJA\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\ROJA\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//span[@title = "Bp"]"}
(Session info: chrome=77.0.3865.90)
please solve as soon as possible