2017-08-17 3 views
-1

私は私のsynfonyにはPHPUnitやFacebook \ webdriverを持ついくつかのテストを作成するだけのコード例PHPUnitの

<?php 
// An example of using php-webdriver. 
namespace Facebook\WebDriver; 
use Facebook\WebDriver\Remote\DesiredCapabilities; 
use Facebook\WebDriver\Remote\RemoteWebDriver; 
require_once('../vendor/autoload.php'); 
// start Firefox with 5 second timeout 
$host = 'http://localhost:4444/wd/hub'; // this is the default 
$capabilities = DesiredCapabilities::firefox(); 
//System.setProperty("webdriver.gecko.driver", ""); 
$driver = RemoteWebDriver::create($host, $capabilities, 5000); 
// navigate to 'http://www.seleniumhq.org/' 
$driver->get('http://www.seleniumhq.org/'); 
// adding cookie 
$driver->manage()->deleteAllCookies(); 
$cookie = new Cookie('cookie_name', 'cookie_value'); 
$driver->manage()->addCookie($cookie); 
$cookies = $driver->manage()->getCookies(); 
print_r($cookies); 
// click the link 'About' 
$link = $driver->findElement(
WebDriverBy::id('menu_about') 
); 
$link->click(); 
// wait until the page is loaded 
$driver->wait()->until(
WebDriverExpectedCondition::titleContains('About') 
); 
// print the title of the current page 
echo "The title is '" . $driver->getTitle() . "'\n"; 
// print the URI of the current page 
echo "The current URI is '" . $driver->getCurrentURL() . "'\n"; 
// write 'php' in the search box 
$driver->findElement(WebDriverBy::id('q')) 
->sendKeys('php'); 
// submit the form 
$driver->findElement(WebDriverBy::id('submit')) 
->click(); // submit() does not work in Selenium 3 because of bug 
https://github.com/SeleniumHQ/selenium/issues/3398 
// wait at most 10 seconds until at least one result is shown 
$driver->wait(10)->until(
WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(
    WebDriverBy::className('gsc-result') 
) 
); 
// close the Firefox 
$driver->quit(); 

私はこのエラーに

PHPの致命的なエラーが発生しますテストしてい:キャッチされないのFacebookを\ webdriverを\例外の\ WebDriverCurlException:のparamsと/セッションへのHTTP POSTのためにスローされたカールのエラー:{ "desiredCapabilities":{ "browserName": "Firefoxの"、 "プラットフォーム": "ANY"、 "firefox_profile": "UEsDBBQAAAAAAGGCEUvf9RXUMgAAADIAAAAHAAAAdXNlci5qc3VzZXJfcHJlZigicmVhZGVyLnBhcnNlLW9uLWxvYWQuZW5hYmxlZCIsIGZhbHNlKTsKUEsBAhQDFAAAAAAAYYIRS9/1FdQyAAAAMgAAAAcAAAAAAAAAAAAAALaBAAAAAHVzZXIuan NQSwUGAAAAAAEAAQA1AAAAVwAAAAAA "}}

は、ポート4444をlocalhostに接続できませんでした:接続が/var/www/html/schweppes-sf/src/main/php/vendor/facebook/webdriver/lib/Exception/WebDriverException.phpに拒否しました。 92 スタックトレース:

0 /var/www/html/schweppes-sf/src/main/php/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php(320):Facebookの\ webdriverを\例外\ WebDriverException :: throwException(-1、 'Curl error thro ...'、Array)

1/var/www/html/schweppes-sf/src/main/php/vendor/facebook/webdriver/lib/Remote /RemoteWebDriver.php(100):Facebook \ WebDriver \ Remote \ HttpCommandExecutor-> execute(Object(Facebook \ Web) Driver \ Remote \ WebDriverComman /var/www/html/schweppes-sf/src/main/php/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 92

私はそれを修正する方法はありませんホストを変更する必要がありますか?

答えて

0

誰かがこの問題を抱えているのは、mi selenium-server-standaloneがダウンしていたためです。