以下图的报错为例
查看错误日志,主要查看以File开头的第一行错误日志和包含exceptions的最后一行日志
1、以File开头的第一行错误日志(了解报错的文件名和行号):
File "C:/Users/Administrator/PycharmProjects/SeleniumTest/chapter2/LoginTest.py", line 7, in <module>
driver.find_element_by_class_name("login_btn fl").click()
解释:在文件,"C:/Users/Administrator/PycharmProjects/SeleniumTest/chapter2/LoginTest.py"-》文件详细路径,line 7-》第七行代码有问题
2、包含exceptions的最后一行日志(了解错误发生的原因,关键字:exception):
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Compound class names not permitted
主要查看:Compound class names not permitted
百度搜索,得知该语句意思:遇到复合class名称不允许使用
即可定位到问题