我发现this python script on github,它通过Selenium发送自动的WhatsApp Web消息。WhatsApp Web自动化,Selenium无法正常工作
#https://www.github.com/iamnosa
#Let's import the Selenium package
from selenium import webdriver
#Let's use Firefox as our browser
web = webdriver.Firefox()
web.get('http://web.whatsapp.com')
input()
#Replace Mr Kelvin with the name of your friend to spam
elem = web.find_element_by_xpath('//span[contains(text(),"Mr Kelvin")]')
elem.click()
elem1 = web.find_elements_by_class_name('input')
while True:
elem1[1].send_keys('hahahahahahaha')
web.find_element_by_class_name('send-container').click()
即使它是为了发送垃圾邮件,我试图适应它有一个很好的目的,但脚本,因为它似乎并没有工作。通过WhatsApp Web发送消息,而不是通过WhatsApp Web发送消息,它只是加载一个QR认证屏幕,然后在我使用手机进行身份验证后它什么也不做。
任何线索为什么发生这种情况?我正在Firefox上运行最新版本的Selenium WebDriver,并且geckodriver已经被提取到/ usr/bin /中。