PHP可以用selenium打开私有浏览器吗?

时间:2014-08-20 12:31:09

标签: php firefox selenium

我使用sebastian bergmann的selenium phpunit。 (facebook Webdriver) 我如何设置普通的Firefox浏览器:

public function setUp()
    {
        // Browser Choice
        $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'firefox');
        // Some more code to setup
    }

问题:

现在我想在私人模式下打开Firefox浏览器。 我该怎么做?打开chrome / IE私有浏览器的方式是否相同?

1 个答案:

答案 0 :(得分:1)

我目前没有安装硒。所以这是未经测试的。

$profile = new FirefoxProfile();

$profile->setPreference(
  'browser.privatebrowsing.autostart',
  true
);

$capabilities = array(
    \FirefoxDriver::PROFILE, $profile
);