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) –
我添加了錯誤信息。 –