Skip to content

Commit

Permalink
修复appium的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
seveniruby committed Dec 2, 2021
1 parent ad154ea commit 8a460e8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
16 changes: 11 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@

<groupId>com.ceshiren.appcrawler</groupId>
<artifactId>appcrawler</artifactId>
<version>2.7.2</version>
<version>2.7.3</version>
<name>appcrawler</name>
<description>app crawler for automation testing, 全平台遍历测试工具,霍格沃兹测试开发学社出品,交流论坛 https://ceshiren.com/c/opensource/appcrawler</description>
<description>
-------------------------------------------------
appcrawler v2.7.3 全平台自动遍历测试工具
Q&amp;A: https://ceshiren.com/c/opensource/appcrawler
author: 思寒 seveniruby@霍格沃兹测试开发学社
-------------------------------------------------
</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<java.version>8</java.version>
<junit.platform.version>1.3.1</junit.platform.version>
<aspectj.version>1.9.2</aspectj.version>
<allure.version>2.15.1</allure.version>
Expand Down Expand Up @@ -390,8 +396,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/ceshiren/appcrawler/Banner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Banner {
val banner =
"""
|-------------------------------------------------
|appcrawler v2.7.2 全平台自动遍历测试工具
|appcrawler v2.7.3 全平台自动遍历测试工具
|Q&A: https://ceshiren.com/c/opensource/appcrawler
|author: 思寒 seveniruby@霍格沃兹测试开发学社
|-------------------------------------------------
Expand Down
27 changes: 11 additions & 16 deletions src/main/scala/com/ceshiren/appcrawler/core/Crawler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,16 @@ class Crawler {
//todo: 主要做遍历测试和异常测试. 所以暂不使用selendroid
log.info(automationName)
val driver=automationName match {
case "selenium" => {
case "selenium" =>
new SeleniumDriver(conf.capability)
}
//todo: 以后使用restful接口支持atx和macaca
/* case "macaca" => {
log.info("use macaca")
driver = new MacacaDriver(url, conf.capability)
}*/
case "adb" => {
case "adb" =>
log.info("user adb")
new AdbDriver(conf.capability)
}


//todo: 把androidDriver与seleniumdriver独立
Expand All @@ -335,25 +333,21 @@ class Crawler {
}
}*/

case "uiautomator2server" => {
case "uiautomator2server" =>
log.info("use uiautomator2server")
new UIAutomator2ServerDriver(conf.capability)
}
case appium if appium==null || appium.isEmpty || appium.toLowerCase.equals("appium") => {
log.info("use AppiumClient")
log.info(conf.capability)
//fixed: appium 6.0.0 has bug with okhttp
//System.setProperty("webdriver.http.factory", "apache")
new AppiumClient(conf.capability)
}
case className => {
case className if className.contains(".") =>
log.info(s"use ${className}")
val clazz=Class.forName(className)
log.info(clazz)
val instance=clazz.getConstructor(classOf[immutable.Map[String, Any]]).newInstance(conf.capability).asInstanceOf[ReactWebDriver]
log.info(instance)
instance
}
case _ =>
log.info("use AppiumClient")
//fixed: appium 6.0.0 has bug with okhttp
//System.setProperty("webdriver.http.factory", "apache")
new AppiumClient(conf.capability)
}
log.info(driver)
driver
Expand Down Expand Up @@ -1074,7 +1068,8 @@ class Crawler {
}
case this.backAppAction => {
log.info("backApp")
driver.launchApp()
// driver.launchApp()
driver.backApp()
}
case this.afterAllAction => {
if (conf.afterAll != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class CrawlerConf {

}

def toYaml: String = {
def toYaml(): String = {
val mapper = new ObjectMapper(new YAMLFactory())
mapper.registerModule(DefaultScalaModule)
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ abstract class ReactWebDriver {

def launchApp(): Unit

def getPageSource: String
def getPageSource(): String


//todo: 有的时候会出现极少内容的page source
Expand Down

0 comments on commit 8a460e8

Please sign in to comment.