1

Using python, chromedriver and Windows. I've working on a script for some months which uses .click() function regularly, few days ago it stopped working anywhere on the site. I've been trying to locate the element by id, xpath, etc... or even click it by send_keys(Keys.ENTER) with no success. I'm just trying to click the login icon but nothing happens. Seems to find the element and even click it, but nothing happens. This is the site and here the code:

browser = webdriver.Chrome(chrome_options=options, executable_path=r'chromedriver.exe')

browser.get(('https://es.wallapop.com/'))

signInButton = WebDriverWait(browser, 5).until(EC.element_to_be_clickable((By.ID, 'js-show-login-modal')))
signInButton.click()

signInButton = WebDriverWait(browser, 5).until(EC.element_to_be_clickable((By.ID, 'btn-go-login-form')))
signInButton.click()

a part from not working this is what I get from the terminal:

Traceback (most recent call last):
  File "wallapop_delete.py", line 55, in <module>
    signInButton = WebDriverWait(browser, 5).until(EC.element_to_be_clickable((B
y.ID, 'btn-go-login-form')))
  File "C:\Users\zaico\AppData\Local\Programs\Python\Python36\lib\site-packages\
selenium\webdriver\support\wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

and this is what should happen on the browser:

-first click on the icon enter image description here

-and after this should appear enter image description here

DebanjanB
  • 118,661
  • 30
  • 168
  • 217
Zaico
  • 31
  • 1
  • 10
  • Did you check for (browser)errors ? – Jeroen Heier Jun 13 '18 at 18:03
  • what is your chrome and chrome driver version – Prany Jun 13 '18 at 18:04
  • What happens when you run this code? Does it open any of the popup modals? – Jim Jun 13 '18 at 18:09
  • @JeroenHeier what do yo mean by browser errors? – Zaico Jun 13 '18 at 18:19
  • @Prany prior to last. But try it on the last too – Zaico Jun 13 '18 at 18:20
  • @Jim added prompt to the question – Zaico Jun 13 '18 at 18:20
  • @Zaico Could you add the output from `chromedriver --version`? I'm getting a different error when I run your code (`Message: unknown error: unknown sessionId`) but simply wrapping the `browser.get(...)` line with a try/except WebDriverException bypasses it and your code seems to work fine. – G_M Jun 13 '18 at 18:21
  • 1
    @Zaico- I didn't get you, please add the version number of both chrome browser and chrome driver – Prany Jun 13 '18 at 18:22
  • @Prany Versión 67.0.3396.87 for the browser and 2.38.551601 for chromedriver – Zaico Jun 13 '18 at 18:42
  • @DeliriousLettuce added images of what should happen on the browser to check if its working – Zaico Jun 13 '18 at 18:49
  • have you tried increasing your `WebDriverWait` `wait` time higher than 5 seconds? – AussieJoe Jun 13 '18 at 18:53
  • 1
    @Zaico Yes, I've seen those screens as your code worked with my old chromedriver (2.36?) with a try/except. I just upgraded my chromedriver to the latest (2.40?) and your code works without any modifications at all. Have you tried upgrading your chromedriver? – G_M Jun 13 '18 at 18:53
  • 1
    @Zaico - Please update your chromedriver to 2.40 – Prany Jun 13 '18 at 18:54
  • thanks everyone. Now I'm having another problem related to the same issue. Should I open another question and close this as answered? – Zaico Jun 13 '18 at 21:37

1 Answers1

1

As per the url you have shared to click on the link with text as Regístrate o inicia sesión you can take help of either of the following Locator Strategies:

  • LINK_TEXT
  • PARTIAL_LINK_TEXT
  • CSS_SELECTOR
  • XPATH

Here is the sample code using PARTIAL_LINK_TEXT:

# -*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

options = webdriver.ChromeOptions() 
options.add_argument("start-maximized")
options.add_argument('disable-infobars')
browser=webdriver.Chrome(chrome_options=options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
browser.get("https://es.wallapop.com/")
WebDriverWait(browser, 5).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, 'strate o inicia sesi'))).click()

Browser Snapshot:

strate o inicia sesi

DebanjanB
  • 118,661
  • 30
  • 168
  • 217
  • thanks. The problem is once I login elements clicked once working aren't anymore. For instance if it tray to click on ```WebDriverWait(browser, 5).until(EC.element_to_be_clickable((By.XPATH, '/html/body/tsl-root/tsl-list/div/div/div/tsl-catalog-item[1]/div/div[2]/span[2]/span/button[4]'))).click()``` nothing happens, even no error – Zaico Jun 14 '18 at 10:21