简体   繁体   中英

Python Selenium Chrome Driver doesnt find elements

I'm working on a python selenium script. I find some elements in firefox by the command :

large_bu = driver.find_elements_by_class_name('butik.large.col-lg-12.col-md-12.col-xs-12')

and len(large_bu) returns 20.

But when i try this in Chrome Driver len(large_bu) returns 0 . How can i find this elements in Chrome Driver ?

Thanks for your replies. sorry for my bad English.

This is an issue between different versions of selenium. find_elements_by_class_name doesn't allow multiple classes anymore, you should use find_elements_by_css_selector instead:

driver.find_elements_by_css_selector('.butik.large.col-lg-12.col-md-12.col-xs-12')

That should return a list with all the matches for that CSS selector.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM