【问题标题】:python selenium - how to execute mobile chrome on incognito mode?python selenium - 如何在隐身模式下执行移动 chrome?
【发布时间】:2018-01-16 08:43:11
【问题描述】:

我正在尝试使用 python selenium 实现移动 chrome 爬虫。

我想在隐身模式下执行移动 chrome。 所以,我尝试如下。

options = webdriver.ChromeOptions()
## run chrome on incognito mode not to use web cache.
options.add_argument("--incognito")
options.add_experimental_option('androidPackage','com.android.chrome')

driver = webdriver.Chrome(chrome_options=options)

但是,移动 chrome 是在默认模式下执行的,而不是隐身模式。 请帮帮我。

【问题讨论】:

标签: python google-chrome selenium mobile


【解决方案1】:

官方推荐的使用 Python 在移动设备上启动 Chrome 的方法是:

driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                      desired_capabilities = chrome_options.to_capabilities())

看看这是否适合你。

【讨论】:

    【解决方案2】:

    对我有用

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--incognito")
    
    driver = webdriver.Chrome("driver path", chrome_options=chrome_options)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-13
      • 1970-01-01
      • 1970-01-01
      • 2012-08-05
      • 2022-08-12
      • 2013-10-02
      • 1970-01-01
      相关资源
      最近更新 更多