Reputation: 13
So I'm trying to find this <ul>
tag I found using inspect element on chrome:
<ul class = "jobs-search-results__list artdeco-list" itemtype="http://schema.org/ItemList"></ul>
This is what I tried in Python:
ul = driver.find_element_by_class_name("jobs-search-results__list artdeco-list")
Which should return the <ul>
tag.
Instead I get this error:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:{"method":"class","selector":"jobs-search-results__list artdeco-list"}
I get the same error whether I use a tag/xpath/absolutepath selector.
Then I find out this element is not on the HTML page source, and so selenium can't find it. HTML Source (pastebin)
How do I go about finding this element if its not on the page source?
Upvotes: 1
Views: 1969
Reputation: 1789
The class
of ul
element that you are trying to get is changing while accessing site using Selenium
. For this use the xpath as
//ul[contains(@class,'jobs-search__results')]
Now you can find ul
element as
ul = driver.find_element_by_xpath("//ul[contains(@class,'jobs-search__results')]")
Upvotes: 1