我正在尝试自动使用来自https://voice.google.com/about
的python和selenium发送文本消息。
我可以使用用户名和密码登录,但是一旦登录并尝试单击左侧的消息图标,它就会给我error(10054, 'An existing connection was forcibly closed by the remote host')
try:
url = "https://voice.google.com/about"
driver.get(url)
time.sleep(5)
print("Session id 1", driver.session_id)
# Click on a GET GOOGLE VOICE
WebDriverWait(driver, 60).until(
EC.element_to_be_clickable((By.XPATH, '//*[@id="heroToggle"]/button/span'))).click()
print("Clicked on a get google voice")
# Click on a WEB
WebDriverWait(driver, 60).until(
EC.element_to_be_clickable((By.XPATH, '//*[@id="heroToggle"]/div/button[3]'))).click()
print("Clicked a C2C button.")
# Enter username and password
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.ID, 'identifierId')))
email = driver.find_element_by_id('identifierId')
email.send_keys('username')
nextBtn = driver.find_element_by_xpath('//*[@id="identifierNext"]/content/span')
nextBtn.click()
# Enter password
password = driver.find_element_by_xpath('//*[@id="password"]/div[1]/div/div[1]/input')
password.send_keys('password')
nextBtn = driver.find_element_by_xpath('//*[@id="passwordNext"]/content')
nextBtn.click()
print("Session id 2", driver.session_id)
# driver.refresh()
# time.sleep(10)
# Click on a message icon. THIS IS WHERE I GET AN ERROR
# WebDriverWait(driver, 60).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.material-icons-extended.IhMtsf-Bz112c'))).click()
msg = driver.find_element_by_css_selector('.gb_ye.gb_Ae')
msg.click()
print("Session id 3", driver.session_id)
except Exception as e:
print("Error===>", e)
我检查了其他答案,但是没有用。
我不确定自己在做什么错。任何帮助将不胜感激。