How to search title in HTML using XPath?
I am trying to get 'RGF Administrator' text from the html example below. The difficulty is that title can take two values: 'Application Settings' or 'Параметры приложения'. At the same time, html may contain other elements with title = 'Application options'.
Which can i use xPath for it?
<div> <button title="Application options"> <span> <span> <bdi> RGF Administrator </bdi> </span> </span> </button> </div>
I use selenium, but I can't determine the xPath for 'RGF Administrator'.
xpath = "//*[@title='Параметры приложения' or @title='Application options']"
won't work since at the same time, html may contain other elements with title = 'Application options'.
If you are using selenium, then you need to use the
get_attribute(string)method. So for example, when you find the elements xpath:
element = driver.find_element_by_xpath("xpath")
and then do
Try this xpath expression on your actual xml and see if it works:
//div/button[@title = ('Параметры приложения', 'Application options')]//bdi/text()
How many bdi containers do you have on the webpage? If there is only 1, you can literally just use
And you don't need any pathing.