Ubuntu — не могу заставить работать php-webdriver

Я хотел бы бежать автоматизированные тесты в браузере которые требуют, чтобы библиотеки из github.com/facebook/php-webdriver установлены.

Я работаю на Ubuntu 14.04 под управлением Apache2.

Я следую за Получить код шаги от репозитория GitHub, но когда я пытаюсь запустить php composer.phar install Я получаю некоторые предупреждения, что мне не хватает пакетов и расширений.

php-webdriver: (master)$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- phpdocumentor/phpdocumentor v2.0.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.0.1 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.1.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.2.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.3.2 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.4.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.5.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.6.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.6.1 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.7.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.7.1 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.8.0 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.8.1 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.8.2 requires phpdocumentor/template-zend ~1.3 -> satisfiable by phpdocumentor/template-zend[1.3.0, 1.3.1, 1.3.2].
- phpdocumentor/phpdocumentor v2.3.1 requires dompdf/dompdf dev-master@dev -> no matching package found.
- phpdocumentor/phpdocumentor v2.3.0 requires dompdf/dompdf dev-master@dev -> no matching package found.
- phpdocumentor/template-zend 1.3.2 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
- phpdocumentor/template-zend 1.3.1 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
- phpdocumentor/template-zend 1.3.0 requires ext-xsl * -> the requested PHP extension xsl is missing from your system.
- Installation request for phpdocumentor/phpdocumentor 2.* -> satisfiable by phpdocumentor/phpdocumentor[v2.0.0, v2.0.1, v2.1.0, v2.2.0, v2.3.0, v2.3.1, v2.3.2, v2.4.0, v2.5.0, v2.6.0, v2.6.1, v2.7.0, v2.7.1, v2.8.0, v2.8.1, v2.8.2].

Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Возможно, я не добавил зависимость в packagist шаг правильно? Для этого шага я обновил файл composer.json:

{
"name": "facebook/webdriver",
"description": "A php client for WebDriver",
"keywords": ["webdriver", "selenium", "php", "facebook"],
"homepage": "https://github.com/facebook/php-webdriver",
"type": "library",
"license": "Apache-2.0",
"support": {
"issues": "https://github.com/facebook/php-webdriver/issues",
"forum": "https://www.facebook.com/groups/phpwebdriver/",
"source": "https://github.com/facebook/php-webdriver"},
"require": {
"php": ">=5.3.19",
"facebook/webdriver": "dev-master"},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpdocumentor/phpdocumentor": "2.*"},
"autoload": {
"classmap": ["lib/"]
}
}

Я добавил "facebook/webdriver": "dev-master" линия правильно?

Я пытался продолжать следующий шаг и работает java -jar selenium-server-standalone-2.45.0.jar но тогда я получаю эту ошибку в терминале.

php-webdriver: (master)$ java -jar selenium-server-standalone-2.45.0.jar
12:21:07.240 INFO - Launching a standalone server
12:21:07.318 INFO - Java: Oracle Corporation 24.75-b04
12:21:07.318 INFO - OS: Linux 3.13.0-46-generic amd64
12:21:07.390 INFO - v2.45.0, with Core v2.45.0. Built from revision 5017cb8
12:21:07.557 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
12:21:07.656 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
12:21:07.659 INFO - Version Jetty/5.1.x
12:21:07.660 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
12:21:07.666 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:21:07.667 INFO - Started HttpContext[/,/]
12:21:07.739 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@2a4c6a7d
12:21:07.739 INFO - Started HttpContext[/wd,/wd]
12:21:07.742 WARN - Failed to start: SocketListener0@0.0.0.0:4444
Exception in thread "main" java.net.BindException: Selenium is already running on port 4444. Or some other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:491)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:300)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:97)

ОБНОВИТЬ

Что касается второй части моего вопроса по запуску файла jar селена, я попробовал решение, предложенное @acfreitas ниже, но все равно получил то же сообщение об ошибке.

php-webdriver: (master)$ kill -9 {pid from selenium process}
bash: kill: {pid: arguments must be process or job IDs
bash: kill: from: arguments must be process or job IDs
bash: kill: selenium: arguments must be process or job IDs
bash: kill: process}: arguments must be process or job IDs
php-webdriver: (master)$ ps aux | grep selenium
ross      3451  0.0  0.7 2413344 45508 pts/12  Tl   14:53   0:00 java -jar selenium-server-standalone-2.45.0.jar
ross      7874  0.0  0.0  15940   944 pts/12   S+   16:14   0:00 grep --color=auto selenium
php-webdriver: (master)$ java -jar selenium-server-standalone-2.45.0.jar
16:15:00.689 INFO - Launching a standalone server
16:15:00.767 INFO - Java: Oracle Corporation 24.75-b04
16:15:00.767 INFO - OS: Linux 3.13.0-46-generic amd64
16:15:00.833 INFO - v2.45.0, with Core v2.45.0. Built from revision 5017cb8
16:15:00.984 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
16:15:01.062 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
16:15:01.063 INFO - Version Jetty/5.1.x
16:15:01.064 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
16:15:01.065 INFO - Started HttpContext[/selenium-server,/selenium-server]
16:15:01.065 INFO - Started HttpContext[/,/]
16:15:01.142 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@2a4c6a7d
16:15:01.143 INFO - Started HttpContext[/wd,/wd]
16:15:01.156 WARN - Failed to start: SocketListener0@0.0.0.0:4444
Exception in thread "main" java.net.BindException: Selenium is already running on port 4444. Or some other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:491)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:300)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:97)

0

Решение

Здесь есть два вопроса:

Первый вопрос

Ваш композитор не может разрешить зависимости от facebook / webdrive и флаги минимальной стабильности.
добавлять "minimum-stability": "dev"

{
"name": "facebook/webdriver",
"description": "A php client for WebDriver",
"keywords": ["webdriver", "selenium", "php", "facebook"],
"homepage": "https://github.com/facebook/php-webdriver",
"type": "library",
"license": "Apache-2.0",
"support": {
"issues": "https://github.com/facebook/php-webdriver/issues",
"forum": "https://www.facebook.com/groups/phpwebdriver/",
"source": "https://github.com/facebook/php-webdriver"},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.19",
"facebook/webdriver": "dev-master"},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpdocumentor/phpdocumentor": "2.*"},
"autoload": {
"classmap": ["lib/"]
}
}

и беги

$ php composer.phar install

Второй вопрос

Порт Selenium по умолчанию 4444, Exception in thread "main" java.net.BindException: Selenium is already running on port 4444. Or some other service is. сказал, что селен уже запущен. Если вы хотите запустить снова, вы можете убить процесс как:

$ $ ps aux | grep selenium
root   3997  2.6  3.2 465024 33336 pts/0    Sl+  15:40   0:00 java -jar selenium-server-standalone-2.45.0.jar
$ kill -9 3997

Видеть, что 3997 около ПИД-регулятор от процесса селена. Поменяй на свой пид.

или запустите selenium с помощью этой команды:

$ java -jar selenium-server-standalone-2.45.0.jar -role hub -port 4441

Итак, вы должны отредактировать порт хоста в ваших тестах. Больше информации вы можете увидеть доктор

2

Другие решения

Просто хотел прокомментировать, почему страница GitHub Readme не советовала использовать «минимальная стабильность»: «dev». Это потому, что это плохая идея / практика.

Один из способов решить эту проблему — просто опустить
минимальная стабильность до «dev». Но обычно это очень плохая идея,
потому что это относится ко всем ограничениям и в результате вы получите
нестабильные версии всех пакетов.

Так что, пожалуйста, не делай этого.

(увидеть https://igor.io/2013/02/07/composer-stability-flags.html)

2

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector