Nimish Bansal
Nimish Bansal

Reputation: 1759

element not found python selenium

I want the link of the button when they are clicked or those elements of button

from selenium import webdriver
browser=webdriver.Chrome()
browser.get("http://fileml.com/l/0wC1#/offers")
elemlist=browser.find_elements_by_xpath("ul/li/a")

But elemlist is also empty neither I can get those elements nor I can get the href But once it clicked it opens some url

So is there any what that I can atleast get elements of those buttons

Upvotes: 0

Views: 155

Answers (1)

Andersson
Andersson

Reputation: 52665

You get empty list because your XPath expression is incorrect.

Try below:

"//ul/li/a"

Note that "//ul" means unordered list somewhere in the DOM while just "ul" means unordered list which is the root element

Also make sure that you switched to iframe before searching for ul:

browser.switch_to.frame("offer-iframe")

Upvotes: 1

Related Questions