Beginners automated testing, it seems that everyone is nine out of ten are using Baidu website practiced hand, hereby thank Baidu.
The main http://www.baidu.com page is the search box and the Submit button:
Input box element properties: <input id= "kw" Name= "wd" class= "S_ipt" value= "" maxlength= "255" autocomplete= "Off" >
Main attributes include ID, name, class, etc.
Submit Button "Baidu" element properties: <input id= "su" value= "Baidu a Bit" class= "BG s_btn" type= "Submit" >
This includes the following: ID, class attribute (the value of the class attribute is included with a space, need to be processed)
The following workarounds are available:
1 #self.browser.find_element_by_class_name ("BG s_btn"). Submit () #使用class_name会报错2Self.browser.find_element_by_class_name ("s_btn"). Submit ()#First Solution: Class value one of them3Self.browser.find_element_by_class_name ("BG"). Submit ()#First Solution: Class value one of them4Self.browser.find_element_by_css_selector (". Bg.s_btn"). Submit ()#Second workaround: Use Css.selector, preceded by each class value.5Log.info ("identify the Name property and execute [find_element_by_name]")
Mark
Selenium solution for Webdriver recognition of class attributes with spaces in multiple values