Home > Blockchain >  Uable to access element in dropdown using xpath
Uable to access element in dropdown using xpath

Time:08-03

I have a web page with a time zone drop-down where I want to access the options enter image description here

The HTML is as follows:

            <li>
              <div id="ember2503"  tabindex="0"><!---->
                (UTC-11:00) Midway Island, Samoa
              </div>
            </li>

I want to select the option using the text attribute. Using text attribute will allow me to access the option by just having a variable 'capital's name'.

I tried to access this with text() attribute but it is not visible. Here is the XPath:

//div[contains(text(),'Midway')]

This XPath is not working. Is there any way to access this?

CodePudding user response:

Try this one instead

//div[contains(.,'Midway')]
  • Related