5

How do I select a div using both it's id and class in Selenium firefox addon?

EDIT: I managed to solve it, I used an xpath expression with both the attributes @id= and @class =

Rnet
  • 4,326
  • 9
  • 42
  • 81

3 Answers3

28

I stumbled upon this question and thought I would leave an example of the answer that the OP didn't leave (as requested by vincebowdren above):

//*/fieldset[@class="openable"][@id="activityFieldset"]

This would select a fieldset element with the openeable class and activityFieldset id.

jjj
  • 685
  • 1
  • 7
  • 14
0

I would like to post another correct answer for future reference.

First of all there have been other correct answers here: https://stackoverflow.com/a/42996525/6569715

A valid example would be to define a locator by multiple attributes:

HEADER_1_TEXT = (
       By.XPATH, 
       "//h2[@class='text-primary' and @id='my-id' and text() ='Get started with Us']")
-6

I managed to solve it, I used an xpath expression with both the attributes @id= and @class =

Rnet
  • 4,326
  • 9
  • 42
  • 81