F
F
Freeshca2022-02-12 22:07:34
Python
Freeshca, 2022-02-12 22:07:34

How to click on a tag where href=javascript:void(0) using Python Selenium?

Here is the Html: 6208050eddd96764778947.png

Here is the code:

element = brain.find_element(By.CLASS_NAME, 'js-submit c-button c-button--large ht')
brain.execute_script("arguments[0].click();", element)

As a result, the error
Message pops up: no such element: Unable to locate element

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Freeshca, 2022-02-13
@Freeshca

The error was that it is necessary not to search for an element by class, but by its xpath.
Apparently it works this way because of the spaces in the class name. Funny...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question