2017-02-02 37 views

回答

3

您可能希望覆蓋TestCase::driver功能是這樣的:

protected function driver() 
{ 
    // iPhone 6, for instance 
    $ua = 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'; 
    $capabilities = DesiredCapabilities::chrome(); 
    $options = new ChromeOptions; 
    $options->setExperimentalOption('mobileEmulation', ['userAgent' => $ua]); 

    return RemoteWebDriver::create(
     'http://localhost:9515', $options->toCapabilities() 
    ); 
}