【问题标题】:Open Chrome in incognito mode on real Android Device using Appium使用 Appium 在真正的 Android 设备上以隐身模式打开 Chrome
【发布时间】:2018-03-16 01:47:29
【问题描述】:

我正在使用 Appium 在 Chrome for Android 上测试我的网站。 我想为 Android 版 Chrome 添加一些选项,例如隐身模式和禁用缓存的可能性。我尝试使用以下示例代码,但它无法正常工作。 Appium 能够在我的 Android 设备上打开 Chrome,但它不是隐身模式,因此它不会禁用浏览器的缓存。

这里是我的 Python 脚本的代码 sn-p:

import appium
from time import sleep

desired_caps = {
    'platformName' : 'Android',
    'platformVersion' : '7.1.1',
    'deviceName' : 'ZX1G423BZQ',
    'browserName' : 'Chrome',
    'chromeOptions': {'args':['--incognito', '--disable-cache']}
}

driver = appium.webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
driver.get("http://www.google.com")

timings = driver.execute_script('return performance.timing')
print(timings)

driver.quit();

我的环境如下:

  • Mac OS X 10.12
  • Android 7.1.1
  • Appium 1.6.4(dmg 包)
  • Python 3.6 和 Appium 的 Python 包装器
  • Chrome v. 61.0.3163.98

我不确定我的错误是什么。也许,我没有正确使用 chromeOptions 参数,但我没有找到正确的方法来利用它。

【问题讨论】:

    标签: android python-3.x appium python-appium appium-android


    【解决方案1】:

    Appium Selenium 中的移动设备驱动程序实例不支持设置隐身/私人模式的功能

    【讨论】:

    猜你喜欢
    • 2023-03-24
    • 1970-01-01
    • 2016-10-12
    • 1970-01-01
    • 2023-04-03
    • 2021-04-10
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多