1

I am trying to get the xpath of the highlighted element(span) in the below image.

I tried the below options and none of them are working:

 //span[contains(text(),'Database')]
 //span[ends-with(., 'Database')]
 //span[text()='\u00A0\u00A0Database']
 //span[contains(., '\u00A0\u00A0Database')]
Ajeet Verma
  • 2,938
  • 3
  • 13
  • 24
Nandan N
  • 23
  • 4

2 Answers2

0

You may try to find the highlighted span tag with its id attribute using XPATH as below:

//span[@id="WD4B-cnt-start"]
Ajeet Verma
  • 2,938
  • 3
  • 13
  • 24
0

Given the HTML:

html

The desired text &nbsp;Database is within the <span>.


Solution

To locate the element you can use either of the following locator strategies:

  • Using XPATH and the text Database`:

    //span[contains(., 'Database')]
    
  • Using XPATH and the text &nbsp;Database:

    //span[contains(., '\u00A0Database')]
    

References

You can find a couple of relevant detailed discussion in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352