-2

Everything Works Fine but then sending part didn't works . click() doesn't work in selenium

from selenium import webdriver
import time

driver = webdriver.Chrome(executable_path="D:/Python/Python/python/chromedriver_win32/chromedriver.exe")
driver.get("https://web.whatsapp.com/")
time.sleep(10)

name = input('Enter the name of user or group : ')
msg = input('Enter the message : ')
count = int(input('Enter the count : '))
user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
user.click()
msg_box = driver.find_element_by_class_name('_3uMse')
for i in range(count):
    msg_box.send_keys(msg)
    button=driver.find_element_by_class_name('_1JNuk')
    button.click()
Jakob F
  • 1,046
  • 10
  • 23
  • You might want to use a `wedriverwait` to let the page load before you click: https://stackoverflow.com/questions/26566799/wait-until-page-is-loaded-with-selenium-webdriver-for-python – F.M Sep 09 '20 at 15:38

1 Answers1

0

wait for the driver to be enabled/displayed, check by using element.isEnabled() & element.isDisplayed().

you can put a retry periodically, basically checking enable in a loop for about 10 seconds(or lower as per your requirement).