Selenium - Click Input with Onclick() event does not work

Asked

Viewed 80 times

-2

I’m having trouble trying to click a button (Input) HTML with Selenium on Internet Explore. When executing the command click() nothing happens nor even errors are presented. Follows below the layout of the HTML code of the Button and then my code in Python.

<td>
<input type = "button" class='botao' value='adicionar todos' onclick="AdicionarTodos()">
<input type = "button" class='botao' value='remover todos' onclick="RemoverTodos()">
</td>

NOTE: I wish to click on the first option "add all"

add_todos_botao = driver.find_element_by_xpath("XPATH")
add_todos_botao.click()

OBS:the XPATH of the object was captured by the google inspection Chrome and used in Internet Explore.

  • 1

    <td> <input type = "button" class='boot' value='add all' onclick="Added()"> <input type = "button" class='boot' value='remove all' onclick="Removed()"> </td>

  • Could add error message that occurs?

  • @Danizavtz, does not return any error. The button just does not perform the expected action.

1 answer

0

You can user the following method, since with Chrome analysis, the page can change structure and be positioning the selector elsewhere, so it’s best to be more specific

driver.find_element_by_xpath('//input[@value="add all"]')

Browser other questions tagged

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