Element does not respond to Selenium click (Python)

Asked

Viewed 79 times

-1

I am recently working with Selenium in Python and facing a problem in my automation:

Selenium identifies the element (either by xpath or any other way), but at the moment of clicking, the element does not behave as expected. Here are 2 images on:

What should happen: inserir a descrição da imagem aqui

What’s going on: inserir a descrição da imagem aqui

If someone did not understand the question, please let me know so that I can elaborate it better. I am really in need of this answer.

Thank you in advance!

  • From what I’ve seen of the image, there’s the attribute disabled="true" on the button you wish to click, you could remove the metatag disabled and after removing click.

2 answers

0

As I noticed, in the first picture the button has an "is-loading" at the end of the class, which is not in the second picture class.

If this is the only form with the "Sort-request" class you can try something like this:

elem = driver.find_element(By.Xpath, "//*[@class='sort-requests']/descedant-or-self::button");
elem.Click();

I usually use Selenium in C#, the code I wrote above based on the official Python documentation.

  • So this could be a mistake or even a kind of protection of the site. With Geckodriver I have this problem, with the direct browser, no.

0

You can use the expected_conditions of Selenium with Phyton to validate whether this element is clickable. In expected_conditions you can use this guy element_to_be_clickable. If the problem is actually the location of the element you can locate it by CSS Selector, then you locate the text element inside the button. It would look something like this:

driver.find_element_by_css_selector('button.send-update > text')

  • The button is clickable. It identifies the element and apparently TRIES to click. When this happens, it just makes a "Hover" and does not occur the event click itself.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.