Seleniun does not work with a website element

Hello guys!

I am totally new in the fórum and I apreciate your work to keep alive this community.

I am trying to automatic a website ckick button using selenium and the next method:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'/html/body/div[5]/div/div/div/div/div[1]/a/div[2]/input'))).send_keys(Keys.RETURN)

The XPATH is referenced to the next website element:

After inspecting the website programming the “Subit Archivos” element is programmed like this:

<input accept="video/*, image/*" multiple="" display="inline-block" type="file" class="_n _5f0v" id="js_31">

When I executed the previous Python method, the linker gives me the next error:

“selenium.common.exceptions.TimeoutException: Message:”

It is like the method is no table to detect the button…Any idea why is happening this?

Thanks in advance


Hola! Bienvenido al foro!

Entiendo que hablás español.

Desconozco el motivo, pero me ha pasado de no poder identificar un elemento, y en general lo resolví cambiando la manera de detectarlo (ej. en vez de hacerlo por XPATH, podés probar hacerlo por el nombre de la class).

Si es un botón, igualmente debería tener un button tag, que sería el que deberías seleccionar realmente, con lo cual te diría revises el HTML a ver si efectivamente existe.

Hi there,

Absolute XPath has a big disadvantage: If the DOM of the page is changed the path of the element changes which leads the XPath to error out. So it’s always recommended to use relative XPath.

For example :
Amazon site

You want to write an XPath for the ‘Add to Cart’ button.
On inspecting the element ’ Add to Cart’ I get the following element

<input id="add-to-cart-button" name="submit.add-to-cart" title="Add to Shopping Cart" data-hover="Select <b>__dims__</b> from the left<br> to add to Shopping Cart" class="a-button-input" type="submit" value="Add to Cart" aria-labelledby="submit.add-to-cart-announce" data-ol-has-click-handler="">

I notice the text ‘Add to Cart’ is uniquely identifying the element so I can construct my XPath using the value attribute.

XPath :

//input[@value = 'Add to Cart']


You can use the attribute ‘title’ for this case since its unique :

//input[@title = 'Add to Shopping Cart']

Can you provide the button element after inspecting it?
A button should have a unique id. Or you can also search by the visible text.

You can discover more about locating elements in Python at

Kindly let me know if you were able to locate the element using this approach.

Hi guys!

I haver alredy solved the problem. You both were right! I changed the way to detect the element and now it is working fine.

Thanks a lot for your help!

1 Like

Hi I open again this case, because I am not able to make click in the next button:

The website is:

I have tried several methods with XPATH and is not working. The element is detected but, I can’t make click on it:

For example I used the next methods without any success:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//button[@value='1'][@id='u_0_c']"))).click()

or this one:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//*[@id="u_0_6"]"))).click()

Any idea?

thanks a lot!


I notice for the XPATH you are using only " which might cause the string to end when it encounters the next "

Try this

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="u_0_6"]'))).click()

You can use a combination of ’ and " for XPath. Kindly let me know if it works.


I have tried your code and I got the next error in the compiler:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,’//*[@id=“u_0_6”]’))).click()
File “D:\Instalables\Python38-32\lib\site-packages\selenium\webdriver\remote\”, line 80, in click
File “D:\Instalables\Python38-32\lib\site-packages\selenium\webdriver\remote\”, line 633, in _execute
return self._parent.execute(command, params)
File “D:\Instalables\Python38-32\lib\site-packages\selenium\webdriver\remote\”, line 321, in execute
File “D:\Instalables\Python38-32\lib\site-packages\selenium\webdriver\remote\”, line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element Aceptar todas is not clickable at point (522, 502). Other element would receive the click: Aceptar todas</butt
on> (Session info: chrome=87.0.4280.141)

Then I have tried the next code and nothing happens. The previous error is gone, but it is not able to make click on the button to accept the cookies.

element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="u_0_6"]')))
driver.execute_script("arguments[0].click();", element)

You need to check where exactly the element you are trying to click present. If the button is present on a different iframe you first need to switch to the window and then try clicking the button.

Check this out: