Parsing the HTML content using compound class using selenium python

末鹿安然 提交于 2019-12-02 00:32:36
Saurabh Gaur

But If I use class="powerOn icon-ok-sign", I get error Compound class names not permitted

Actually selenium doesn't support to locate an element using Compound class name.

You should try using on of then instead as :-

driver.find_element_by_class_name("powerOn")

Or

driver.find_element_by_class_name("icon-ok-sign")

Or best way to use css_selector to locate same element using multiple class name as :-

driver.find_element_by_css_selector(".powerOn.icon-ok-sign")

Reference link :-

You can use search by CSS Selector instead:

driver.find_element_by_css_selector(".powerOn.icon-ok-sign")

or use one of class names to select your element:

driver.find_element_by_class_name("powerOn")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!