Appium測試安卓apk遇到的問題及解決方法

1Showing error - 「Returned value cannot be converted to WebElement: {ELEMENT=1} java

解決方法:https://sqa.stackexchange.com/questions/29424/showing-error-returned-value-cannot-be-converted-to-webelement-element-1web

答案總結:剛開始用的appium-java-client  版本是5.0.4的,報這個錯誤搜索後,被承認的建議是下降appium-java-client版本。降爲5.0.0後不報錯了。sql

2java:NoSuchMethodError: org.openqa.selenium.remote.HttpCommandExecutorapache

解決方法:https://stackoverflow.com/questions/35186/how-do-i-fix-a-nosuchmethoderrorapp

答案總結:用的java-client、selenium-java、selenium-remote-driver版本不兼容,建議selenium-java、selenium-remote-driver版本用最新的。佈局

3Logger的問題測試

答案總結:我遇到的bug是:沒法調用PropertyConfigurator.configure(log4j.properties的路徑)方法,spa

  最終也是在stackoverflow發現的解決辦法,添加好log4j.properties文件後,把該文件放到src/main/resources  目錄下便可。即:src/main/resources/log4j.propertiesdebug

log4j.properties內容以下:3d

#將等級爲debug的日誌信息輸出到stdout和R這兩個目的地,stdout和R的定義在下面的代碼,能夠任意起名
log4j.rootLogger=debug,stdout
# 定義stdout的輸出端是哪一種類型,能夠是ConsoleAppender(控制檯),FileAppender(文件)等
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#指定輸出端的layout(佈局)是哪一種類型
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#以PatternLayout佈局,就是設置輸出格式
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] -%m%n

log4j.logger.java.sql.PreparedStatement=DEBUG

四、junit的問題

答案:我遇到的問題是,建立好類以及測試方法後,右鍵點擊該文件,沒有runAs的選項。後來搜索後,點擊Run->Edit Configurations-點擊「+」->選擇「JUnit」,配置可參考下圖

相關文章
相關標籤/搜索