The <title> of the page is changing. How to get it with XPath?

Viewed 18

Got the page with dynamic <title> tag depending on language selected by user, e.g. <title>English</title> or <title>Italiano</title>

I'm trying to select that page among many others with XPath selector:

//*[contains(@title, 'English') or contains(@title, 'Italiano')]

but it doesn't work at all.

Also tried (//*[contains(@title, 'English')] | //*[contains(@title, 'Italiano')])[1] - no positive result

1 Answers

title is not an attribute, so no need to add @:

//*[contains(title, 'English') or contains(title, 'Italiano')]

This will return parent node. If you want to select title node then try

//title[.='English' or .='Italiano']
Related