【发布时间】:2014-08-15 01:09:33
【问题描述】:
我正在使用 phantomjs 和貂皮:
default:
extensions:
Behat\MinkExtension\Extension:
goutte: ~
selenium2:
browser: phantomjs
wd_host: http://localhost:8643/wd/hub
capabilities:
webStorageEnabled: true
但我需要伪装成最新的 chrome。我试过这个:
/**
* @BeforeStep
*/
public function masqueradeAsLatestChrome(StepEvent $event)
{
$this->getSession()->setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36');
}
但我得到了例外:
[Behat\Mink\Exception\UnsupportedDriverActionException]
Exception has been thrown in "beforeStep" hook, defined in FeatureContext::masqueradeAsLatestChrome()
Request header is not supported by Behat\Mink\Driver\Selenium2Driver
chrome 的版本并不重要,但网络应用程序必须认为它正在与最新版本的 chrome 通信。
【问题讨论】:
标签: selenium phantomjs behat mink