Linked Questions

Popular Questions

same attribute, different value for xpath

Asked by At

I'd like to know if it is possible to make xpath with same attribute but different values shorter, than explicitly say @attributeName all the time. Example - I have two pages with firstName input, in one page it is

//*[@name='first'] 

and in the other

//*[@name='firstName'] 

. So a shared xpath is

//*[@name='first' or @name='firstName']

Is there any way to make it shorter like

//*[(@name)='first' or 'firstName']

I tried different ways of handling that using brackets, but no luck so far.

Related Questions