微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

App Center 上的 Appium 无法在 iOS 和 Android (Java) 之间切换

如何解决App Center 上的 Appium 无法在 iOS 和 Android (Java) 之间切换

当我专门编写 appium 测试以在 App Center 上运行时(因此必须使用自定义的“增强型驱动程序”),看起来我只能将 #Extract features from http_path ["API URL","URL parameters"] regex = r'([^\?]+)\?*(.*)' http_path = df.filter(df['http_path'].rlike(regex)) # http_path #0 https://example.org/path/to/file?param=42#frag... #1 https://example.org/path/to/file # api param #0 https://example.org/path/to/file param=42#fragment #1 https://example.org/path/to/file NaN #where in regex pattern: #- (?:https?://[^/]+/)? optionally matches domain but doesn't capture it #- (?P<api>[^?]+) matches everything up to ? #- \? matches ? literally #- (?P<param>.+) matches everything after ? # Notice we also make \? and the second capture group optional so that when there are no query parameters in http_path,it returns NaN. api_param_df = pd.DataFrame([[row[0][0],np.nan] if row[0][1] == '' else row[0] for row in http_path.values],columns=["api","param"]) df = pd.concat([df['raw'],api_param_df],axis=1) df 声明为 driver 类型,或者EnhancedAndroidDriver 类型。

EnhancedioSDriver

我想在可以在两个平台上运行的单个文件中运行一个简单的测试,但似乎我必须选择 android 或 ios 才能运行该文件。如何避免复制所有测试文件?我正在使用 react native,我的应用程序在两个平台上基本相同。我对常规的 AppiumDriver 做了类似的事情。

是否有任何建议以编程方式切换变量 public EnhancedAndroidDriver<MobileElement> driver; // public EnhancedioSDriver<MobileElement> driver; <----- can't declare same variable twice public AppiumDriver<MobileElement> getDriver() throws IOException { String PLATFORM_NAME = System.getenv("XTC_PLATFORM"); if (PLATFORM_NAME.equals("Android")) { EnhancedAndroidDriver<MobileElement> androiddriver = Factory.createAndroidDriver(new URL("http://localhost:4723/wd/hub"),caps); driver = androiddriver; } else if (PLATFORM_NAME.equals("iOS")) { EnhancedioSDriver<MobileElement> iosdriver = Factory.createIOSDriver(new URL("http://localhost:4723/wd/hub"),caps); driver = iosdriver; <---- compiler error,wrong type } return driver; } 在 Java 中引用的“EnhancedioS/AndroidDriver”类型??

使用常规的 AppiumDriver,我可以做到这一点:

driver

然后在测试中一般使用驱动程序。但是对于 App Center Enhanced 驱动程序似乎不可能采用这种方法,因为它们不共享通用类型(或者我对 Java 了解不够,无法弄清楚)。有什么办法可以解决这个问题吗??

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?