Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Uable to access element in dropdown using xpath

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" class="artdeco-dropdown__item artdeco-dropdown__item--is-dropdown ember-view" 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’.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

Try this one instead

//div[contains(.,'Midway')]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading