0
在WhatsApp的短信自动发送的邮件我的代码是(从geeksforgeeks研究):错误使用python
#!/usr/bin/python
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
# Replace below path with the absolute path
# to chromedriver in your computer
driver = webdriver.Chrome('C:\webdriver\chromedriver.exe')
driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver, 600)
# Replace 'Friend's Name' with the name of your friend
# or the name of a group
target = "Rahul Mehta"
# Replace the below string with your own message
string = "Hi"
y_arg = '//*[@id="side"]/div[2]/div/label/input'
input_y = wait.until(EC.presence_of_element_located((By.XPATH, y_arg)))
input_y.send_keys(target + Keys.ENTER)
inp_xpath = '//*[@id="main"]/footer/div[1]/div[1]/div/div[2]'
input_box = wait.until(EC.presence_of_element_located((By.XPATH,inp_xpath)))
for i in range(2):
input_box.send_keys(string + Keys.ENTER)
time.sleep(1)
我得到的错误为:
[1436:4360:1017/202620.286:ERROR:shader_disk_cache.cc(237)] Failed to create
shader cache entry: -2
我得到命令,在相同的重复错误当我增加范围时提示。浏览器被打开,然后甚至搜索我的朋友的名字,但最终它不会发送消息。请帮助我。我几乎浪费了一整天的时间,但对于如何继续进一步没有线索:(
你介意复制/粘贴错误信息为文本吗?请参考[阻止代码和/或错误的屏幕截图](https://meta.stackoverflow.com/questions/303812 /令人沮丧 - 代码和错误的屏幕截图) –
Pos sple重复[Python Selenium - 通过其关于缓存的Css选择器问题查找元素](https://stackoverflow.com/questions/46393818/python-selenium-locating-an-element-by-its-css-selector-issue -about-caching) –
我添加了错误信息。 –