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.JdbcOdbc...