Home > Net >  Python selenium find element by xpath or css selector
Python selenium find element by xpath or css selector

Time:09-30

how can i click on the "NATIONAL" text with python selenium

<div class="ellipsis__content">
    <ul class="breadcrumb_new" id="breadcrumb">
       <li>
         <span>NATIONAL</span>
       </li>
    </ul>
</div>

I tried these below things,

find_element_by_xpath("//div[@id='breadcrumb']/li/span")
find_element_by_css_selector("#breadcrumb > li > span")

Both the methods not working, any idea here

CodePudding user response:

Try this one, should work for you:

ele=driver.find_element_by_xpath("//*[@id='breadcrumb']//span")
ele.click()
  • Related