我突然开始面对以下错误:
java.lang.IllegalArgumentException:如果使用'@ $ Proxy21'注释,则不能使用'@ $ Proxy23'注释 在io.appium.java_client.pagefactory.DefaultElementByBuilder.checkDisallowedAnnotationPairs(DefaultElementByBuilder.java:46) 在io.appium.java_client.pagefactory.DefaultElementByBuilder.assertValidAnnotations(DefaultElementByBuilder.java:87)
我使用下面的代码来初始化元素:
PageFactory.initElements(new AppiumFieldDecorator(appiumDriver, 6, TimeUnit.SECONDS), this);
它工作得很好&没有任何重大改变,它现在失败了。
Appium版本:1.7.1
我的POM.xml
<dependencies>
<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.java.version}</version>
</dependency>
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>${cucumber.extentsreport.version}</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>${appium.java-client.version}</version>
<!--<version>5.0.0-BETA5</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber-java.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${json-path.version}</version>
</dependency>
<dependency>
<groupId>org.monte.screenrecorder</groupId>
<artifactId>MonteScreenRecorder</artifactId>
<version>10</version>
<scope>system</scope>
<systemPath>${basedir}/lib/monte-screen-recorder-0.7.7.jar</systemPath>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber-junit.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber-junit.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json-simple.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
<!--<dependency>-->
<!--<groupId>org.seleniumhq.selenium</groupId>-->
<!--<artifactId>selenium-chrome-driver</artifactId>-->
<!--<version>3.3.1</version>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<!--<dependency>-->
<!--<groupId>org.springframework</groupId>-->
<!--<artifactId>spring-context</artifactId>-->
<!--<version>${spring-context.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest-library.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<!--Exploratory Cucumber-TestNG Fusion-->
<!--<dependency>-->
<!--<groupId>info.cukes</groupId>-->
<!--<artifactId>cucumber-testng</artifactId>-->
<!--<version>1.2.4</version>-->
<!--<scope>compile</scope>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>junit</groupId>-->
<!--<artifactId>junit</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>info.cukes</groupId>-->
<!--<artifactId>cucumber-spring</artifactId>-->
<!--<version>${cucumber-spring.version}</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework</groupId>-->
<!--<artifactId>spring-context</artifactId>-->
<!--<version>4.3.8.RELEASE</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework</groupId>-->
<!--<artifactId>spring-test</artifactId>-->
<!--<version>4.3.8.RELEASE</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit5-engine</artifactId>
<version>5.0.0-ALPHA</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.testobject</groupId>-->
<!--<artifactId>testobject-appium-java-api</artifactId>-->
<!--<version>0.1.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.browserstack</groupId>
<artifactId>browserstack-local-java</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>report.donut</groupId>
<artifactId>donut</artifactId>
<version>1.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.browserstack</groupId>-->
<!--<artifactId>automate-testassist</artifactId>-->
<!--<version>0.7.2-SNAPSHOT</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.browserstack</groupId>-->
<!--<artifactId>browserstack-integration</artifactId>-->
<!--<version>LATEST</version>-->
<!--</dependency>-->
</dependencies>
我无法弄清楚为什么我突然开始出现这个错误。
答案 0 :(得分:1)
请确保使用最新的客户端库, 5.0.4 ,因为您使用的是Appium 1.7.1。
从.m2\repository
清除maven缓存并从头开始安装依赖项。
也可能在定义某个元素时混合不兼容的注释。点击此处查看working examples