How to find a Select without ID or NAME field

Asked

Viewed 47 times

-1

I have a test project where I have to perform some Inserts in the form and validate if everything is flowing well, but the Dev who created the form did not put select as follows:

<select id="" name="">

He just created:

inserir a descrição da imagem aqui

How do I find this Select when its class is standard Bootstrap (other elements of FORM have the same class...

I’m using Selenium with Python for such, someone has already gone through it?

  • You could do it based on the class, but if you have more than one select with the same class, it would return an array of selects. This way, you would have to place the position of the item in the array. = D

  • @Viana did not understand very good could be a little clearer?

1 answer

0

If someone has the same problem, follow the solution I found:

data.find_element_by_xpath("//select[@class='form-control']/option[text()='" + x + "']").click()

Browser other questions tagged

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