I am working on a bot capable of login into a webpage (postmark.com
). To do that, I am using selenium and python. As it is right now my code is capable of accessing the webpage, clicking on the login tap, inserting the user name and password; however, when it comes to clicking on the Login tap (to access the account) I get the following error
Traceback (most recent call last):
File "/home/pi/Documents/Bot_Poshmark.py", line 20, in <module>
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(Log)).click()
File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/support/wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
The bizarre think about this, is that sometimes (like 2 or 3) the same piece of code that I wrote, can complete all the steps. Here is my code (I am using a Raspberry Pi 4 for this)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get("https://www.poshmark.com") #Open webpage
Log_Field=(By.XPATH, "//a[contains(text(),'Log in')]")
Email= (By.XPATH, "//input[@placeholder='Username or Email']")
Pass= (By.XPATH, "//input[@placeholder='Password']")
Log= (By.XPATH, "//button[@class='btn btn--primary']")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(Log_Field)).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(Email)).send_keys("xxx@xx.com")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(Pass)).send_keys("123456")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(Log)).click()
Do anyone have an idea on why this is happening? Thank you