【问题标题】:How might I simulate a private browsing experience in Watir? (Selenium)如何在 Watir 中模拟私人浏览体验? (硒)
【发布时间】:2012-10-16 11:12:33
【问题描述】:

Watir 是一个基于 Selenium 的黑盒测试工具,可以在浏览器上自动执行任务。

我希望能够打开一个处于隐私浏览模式的 Watir::Browser.new。

谢谢

【问题讨论】:

    标签: ruby watir watir-webdriver privacy


    【解决方案1】:

    对于 Firefox(我不确定其他浏览器),您可以将配置文件设置为启用隐私浏览:

    profile = Selenium::WebDriver::Firefox::Profile.new
    profile['browser.privatebrowsing.dont_prompt_on_enter'] = true
    profile['browser.privatebrowsing.autostart'] = true
    b = Watir::Browser.new :firefox, :profile => profile
    

    这是来自https://github.com/watir/watir-webdriver/issues/95 的解决方案。 它似乎工作(至少主菜单说它是私人浏览)。

    【讨论】:

      【解决方案2】:

      对于 Chrome

      browser = Watir::Browser.new :chrome, switches: ['--incognito']

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-15
        • 1970-01-01
        相关资源
        最近更新 更多