I am using this code:
chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") driver = webdriver.Chrome(options=chrome_options) print("IT RAN>>>>>>>>>>>") driver.get("https://www.upwork.com/ab/account-security/login") print('1') wait_scrape = WebDriverWait(driver, 120) print('2') email_field = wait_scrape.until(EC.element_to_be_clickable((By.ID, "login_username"))) email_field.send_keys(default_email) email_field.send_keys(Keys.RETURN) print('22') driver.maximize_window() time.sleep(4) close_button = wait_scrape.until(EC.element_to_be_clickable((By.ID,"onetrust-accept-btn-handler"))) close_button.click() print('3') time.sleep(2) password_field = wait_scrape.until(EC.element_to_be_clickable((By.ID,"login_password"))) password_field.send_keys(default_password) password_field.send_keys(Keys.RETURN) print('4') time.sleep(5)
The same code is working fine in my local
it prints 1, 2 but then does not move forward. then after 120 seconds, it says:
2023-05-29 13:28:12,303: Exception on /run_scraping [POST] Traceback (most recent call last): File "/home/TahaAnwar01/.virtualenvs/venv/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "/home/TahaAnwar01/.virtualenvs/venv/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e) File "/home/TahaAnwar01/.virtualenvs/venv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request() File "/home/TahaAnwar01/.virtualenvs/venv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/home/TahaAnwar01/mysite/app.py", line 64, in run_scraping
run_rss_feed(selected_case_study, select_rss_url, email, password) File "/home/TahaAnwar01/mysite/bot_functionalities/scraping_bot.py", line 34, in run_rss_feed
email_field = wait_scrape.until(EC.element_to_be_clickable((By.ID, "login_username"))) File "/home/TahaAnwar01/.virtualenvs/venv/lib/python3.10/site-packages/selenium/webdriver/support/wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: