Reputation: 367
I can not find elements by using Firefox web driver, it print 0:
driver = webdriver.Firefox()
driver.get("https://www.unibet.ro/betting#filter/football")
event = driver.find_elements_by_class_name('KambiBC-event-item KambiBC-event-item--type-match')
print (len(event))
But it works when I change the web driver to Edge:driver = webdriver.Edge()
, as i also have the edge web driver set up in my Path environments, printing the right amount of web elements
Upvotes: 0
Views: 2928
Reputation: 862
Looks like the elements you're trying to find are defined with two classes (KambiBC-event-item
and KambiBC-event-item--type-match
).
I believe driver.find_elements_by_class_name()
expects a single class name as an argument, and hence it's not working in your case.
You can try to use the find_elements_by_xpath()
method instead as below (Pl replace the //*
in the xpath with the appropriate element tag name):
event = driver.find_elements_by_xpath("//*[@class='KambiBC-event-item KambiBC-event-item--type-match']")
Upvotes: 2