I have following problem: My script doesn't execute the code between problem-comments. This script should login into yandex-mail page (https://passport.yandex.ru/auth) find by xpath the search-field for mails, click on it and finally entering: subject:(Your Steam account: Access from new web or mobile device). And when the script comes to the point, where it must find the search-field, the programm shuts down.
Here is the code:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
driver = webdriver.Chrome()
driver.get('https://passport.yandex.ru/auth')
try:
email_element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "passp-field-login"))
)
time.sleep(2)
email_element.send_keys("LOGIN", Keys.RETURN)
time.sleep(2)
password_element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "passp-field-passwd"))
)
password_element.send_keys("PASSWORD", Keys.RETURN)
#Wait for the inbox page to load before proceeding
WebDriverWait(driver, 10).until(
EC.title_contains("Inbox")
)
time.sleep(2)
# problem starts here
inbox_element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "//*[@id='js-apps-container']/div[2]/div[7]/div/div[1]/div/div/div[1]/div[2]/div/div/div/div[1]/form/div/span/input"))
)
inbox_element.send_keys("subject:(Your Steam account: Access from new web or mobile device)", Keys.RETURN)
# problem occurs here
# Do something with the inbox page
# ...
except Exception as e:
print(f'An error occurred: {e}')
finally:
driver.quit()
I tried to execute the code but following errors come:
Errors before the problem tags:
[34024:23964:0301/191243.416:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -101
[7428:42888:0301/191245.636:ERROR:device_event_log_impl.cc(218)] [19:12:45.637] USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: Ein an das System angeschlossenes Gerõt funktioniert nicht. (0x1F)
[7428:42888:0301/191245.642:ERROR:device_event_log_impl.cc(218)] [19:12:45.642] USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: Ein an das System angeschlossenes Gerõt funktioniert nicht. (0x1F)
Errors after problem tags:
[34024:23964:0301/191254.717:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -101
[34024:23964:0301/191254.722:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -101