[英]python send message in messenger using selenium
I tried using the following code, I have to manually open the messenger window, It did send the message but after it send one time, it will return me the following error, 'value': keys_to_typing(value)}) return self._parent.execute(command, params)我尝试使用以下代码,我必须手动打开信使 window,它确实发送了消息,但发送一次后,它会返回以下错误,'value':keys_to_typing(value)}) return self._parent .execute(命令,参数)
from selenium import webdriver
driver = webdriver.Chrome("C:\Image\chromedriver.exe")
driver.get('https://www.facebook.com')
for i in range(99):
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')
# user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
# user.click()
msg_box = driver.find_element_by_class_name("_1mf._1mj")
for i in range(count):
msg_box.send_keys(msg," 第",i,"次")
button = driver.find_element_by_class_name('_30yy._38lh._7kpi')
button.click()
The real matter is that you have to take another element to send keys the xpath of the element is //div[@aria-label="Aa"]
so the line to find it will be真正的问题是您必须使用另一个元素来发送键元素的 xpath 是
//div[@aria-label="Aa"]
所以找到它的行将是
driver.find_element_by_xpath('//div[@aria-label="Aa"]')
Liked to help you.喜欢帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.