Search code examples
pythonseleniumselenium-webdriverselenium-chromedriverwebautomation

How do I select a blank window element with a text inside using python selenium


The element that I want to select out is the "No Requests Remaining" part.

browser.find_elements_by_xpath('//a//*[contains(text(),"No Requests Remaining")]')

The above line of code does not work.


Solution

  • Try this: browser.find_element_by_xpath('//div[contains(text(),"No Requests Remaining")]')

    Since we are expecting only one element, we should use .find_element_by_xpath() in this case.