1、cucumber自動化執行提示chrome使用不支持的命令標記 --ignore-certificate-errors
大概問題是chrome版本和chrmedriver版本不對應
2、"code":-32000,"message":"Cannot navigate to invalid URL"
URL地址一定要加上http或https(估計是chrome版本較高的需求)
3、java.lang.NoClassDefFoundError: org/json/JSONObject
一般是缺少jar包引起的,后面指的是具體缺少那個類
4、'mvn' 不是內部或外部命令,也不是可運行的程序或批處理文件。
在cmd里面正常,在idea里錯誤
解決:在環境變量path中增加D:\IDEA\IntelliJ IDEA 2018.2.1\plugins\maven\lib\maven3\bin,然后重啟電腦
5、java.lang.NoClassDefFoundError: gherkin/IGherkinDialectProvider
可能原因是jar沖突
6、Element cucumberOutput is not allowed here
當時的解決是的maven-cucumber-reporting版本從3.19.0改成了3.15.0
7、Cucunber執行多個tags,提示找不到對應的@T1,@T2
tags的寫法錯誤:tags= {"@T1","@T2"} ---> tags={"@T1,@T2"}
8、腳本正確,但控制台執行顯示失敗,,控制台輸入一串:編碼GBK的不可映射字符
原因:編碼格式設置不統一
<properties> <project.build.sourceEncoding> UTF-8</project.build.sourceEncoding> <argLine>-Dfile.encoding=UTF-8</argLine> </properties>
<configuration>
<includes>**/Run.class</includes>
<testFailureIgnore>true</testFailureIgnore>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
另外IDEA里面setting里面都改成UTF-8
9、所有執行成功,但控制台亂碼(mvn clean test)
原因:控制台 編碼格式沒設置好
解決:1)IDEA所有編碼改為UTF-8
2)maven-surefire-plugin 版本問題,目前使用2.20.1
3)Setting->maven->runner--> VMoptions: -Dfile.encoding=GB2312
10、定位信息獲取到,但是執行始終不對,提示 element not visible
解決:加上瀏覽器窗口最大化,有時候可能要加上等待時間