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 了解不够,无法弄清楚)。有什么办法可以解决这个问题吗??

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

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/27188.html

大家都在问