【问题标题】:Everything Works Fine but then sending part didn't works . click() doesn't work in selenium一切正常,但发送部分不起作用。 click() 在硒中不起作用
【发布时间】:2020-09-09 15:29:34
【问题描述】:

一切正常,但发送部分不起作用。 click() 在硒中不起作用

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()

【问题讨论】:

标签: python python-3.x selenium


【解决方案1】:

等待驱动被启用/显示,使用 element.isEnabled() & element.isDisplayed() 检查。

您可以定期重试,基本上在循环中检查启用约 10 秒(或根据您的要求更低)。

【讨论】:

    猜你喜欢
    • 2014-11-01
    • 2015-09-23
    • 2015-05-25
    • 2021-01-10
    • 2019-06-24
    • 2016-05-17
    • 2014-08-13
    • 1970-01-01
    • 2015-10-01
    相关资源
    最近更新 更多