Cucumber使用中问题

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

        解决:加上浏览器窗口最大化,有时候可能要加上等待时间

 

posted @ 2018-08-19 10:56  知了.Test  阅读(1527)  评论(0编辑  收藏  举报