在不启动应用程序的情况下在前台启动(或恢复)应用程序的驱动程序?
Start (or resume) a driver for an app on the foreground without launching the app?
我正在尝试使用 Appium 在 Genymotion 模拟器上模拟 2 个动作:
- 转到特定 URL,该网站然后重定向到 Google Play 商店。
- 在 Google Play 商店屏幕上按“安装”。
我已经设法获得 URL,但是当我尝试启动 Google Play 应用程序的驱动程序时,它会重新启动该应用程序,这是我不想要的。我需要在重定向到 Google Play 后立即模拟单击 INSTALL 按钮。我研究了 运行 并行测试,但它似乎会为每个测试启动该应用程序。
这是我的代码。任何帮助将不胜感激!
from appium import webdriver
desired_caps_web = dict(
platformName='Android',
platformVersion='8',
deviceName='Google Pixel',
automationName='UiAutomator1',
browserName='Chrome',
chromedriverExecutable='C:\Users\Khoa_Ngo\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe')
driver_web = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps_web)
driver_web.get('https://someURL.com')
desired_caps_vending = dict(
platformName='Android',
platformVersion='8',
deviceName='Google Pixel',
automationName='UiAutomator1',
app='/Users/Khoa_Ngo/Google Play Store.apk', #This is bit of a workaround because I kept running into problems about intent action.
appPackage='com.android.vending',
)
driver_vending = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps_vending)
driver_vending.find_elements_by_xpath("//*[contains(@id, 'install')]").click() #Not working
还有我应该如何模拟点击(代码块的最后一行)?
将功能 autoLaunch=false 添加到所需功能。
autoLaunch 自动初始化正在测试的应用程序。如果这是错误的,Appium 不会 install/launch 被测应用程序。默认为 true
描述来自:http://appium.io/docs/en/writing-running-appium/caps/#android-only
我正在尝试使用 Appium 在 Genymotion 模拟器上模拟 2 个动作:
- 转到特定 URL,该网站然后重定向到 Google Play 商店。
- 在 Google Play 商店屏幕上按“安装”。
我已经设法获得 URL,但是当我尝试启动 Google Play 应用程序的驱动程序时,它会重新启动该应用程序,这是我不想要的。我需要在重定向到 Google Play 后立即模拟单击 INSTALL 按钮。我研究了 运行 并行测试,但它似乎会为每个测试启动该应用程序。
这是我的代码。任何帮助将不胜感激!
from appium import webdriver
desired_caps_web = dict(
platformName='Android',
platformVersion='8',
deviceName='Google Pixel',
automationName='UiAutomator1',
browserName='Chrome',
chromedriverExecutable='C:\Users\Khoa_Ngo\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe')
driver_web = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps_web)
driver_web.get('https://someURL.com')
desired_caps_vending = dict(
platformName='Android',
platformVersion='8',
deviceName='Google Pixel',
automationName='UiAutomator1',
app='/Users/Khoa_Ngo/Google Play Store.apk', #This is bit of a workaround because I kept running into problems about intent action.
appPackage='com.android.vending',
)
driver_vending = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps_vending)
driver_vending.find_elements_by_xpath("//*[contains(@id, 'install')]").click() #Not working
还有我应该如何模拟点击(代码块的最后一行)?
将功能 autoLaunch=false 添加到所需功能。
autoLaunch 自动初始化正在测试的应用程序。如果这是错误的,Appium 不会 install/launch 被测应用程序。默认为 true
描述来自:http://appium.io/docs/en/writing-running-appium/caps/#android-only