The solution to the "Python" Selenium element positioning error

Source: Internet
Author: User

Error found when using class to locate elements:

Error message: Selenium.common.exceptions.InvalidSelectorException:Message:Compound class names not permitted (the name of the composite class is not allowed)

Online inquiry information learned:

ClassName does not allow the use of compound class names for parameter "original"

Real-world elements tend to use compound class names (that is, multiple classes are separated by spaces), and when using classname positioning, be aware that the classname parameter can only be a class.

The classname name shown in the example is: btn btn-primary btn-md btn-block Loginbutton Log, we want to use classname to locate this element.

If you take a class full name, the error in the above image will be reported, if you take a class name Driver.find_element_by_class_name ("log"). Click (), you will not get an error.

The solution to the "Python" Selenium element positioning error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.