17

I am new to MTF. I have followed the magento2 tutorial based on the following link

But When I am running the command

vendor/bin/phpunit

I am getting the following error -

Fatal error: Uncaught PHPUnit_Extensions_Selenium2TestCase_WebDriverException: nable to create new service: ChromeDriverService Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22 693Z' System info: host: 'WTW-HP', ip: '192.168.0.31', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '10.0.2'

Driver info: driver.version: unknown in C:\wamp64\www\magento2252\dev\tests\func tional\vendor\phpunit\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase\Driv er.php:165 Stack trace:

0 C:\wamp64\www\magento2252\dev\tests\functional\vendor\phpunit\phpunit-seleniu

m\PHPUnit\Extensions\Selenium2TestCase\Driver.php(71): PHPUnit_Extensions_Seleni um2TestCase_Driver->curl('POST', Object(PHPUnit_Extensions_Selenium2TestCase_URL ), Array)

1 C:\wamp64\www\magento2252\dev\tests\functional\vendor\phpunit\phpunit-seleniu

m\PHPUnit\Extensions\Selenium2TestCase\SessionStrategy\Isolated.php(67): PHPUnit _Extensions_Selenium2TestCase_Driver->startSession(Array, Object(PHPUnit_Extensi ons_Selenium2Test in C:\wamp64\www\magento2252\dev\tests\functional\vendor\phpun it\phpunit-selenium\PHPUnit\Extensions\Selenium2TestCase\Driver.php on line 165

My goal is to learn the MTF and integrate the tests into My custom module

1
  • 1
    First of all, Windows is not a support env for Magento 2. Still, if you want to run on windows, you need to update to chrome-driver from the binaries available at Google, and setup Selenium Server. Commented Dec 9, 2019 at 12:37

4 Answers 4

1

Review your dev/tests/functional/phpunit.xml configuration file

<php>
    <const name="SELENIUM_BROWSER" value="chrome"/>
    <const name="SELENIUM_HOST" value="localhost"/>
    <const name="SELENIUM_PORT" value="4444"/>
    <const name="SELENIUM_PATH" value="/path/to/chromedriver"/>
</php>

Run WebDriver Manually:

/path/to/chromedriver

in commandline.

0

You need to install chrome drivers for selenium.

https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver

0

This issue is occurring due to the google chrome driver version.

You should install the driver version compatible with your chrome version.

0

Below is my bash script that downloads latest "Chrome for Testing" Browser, Latest Chromedriver and Selenium Server. I assume you haven't downloaded your Chromedriver yet, so it might be useful for you.

#!/bin/bash
function INFO() {
    COLOR='\e[33m'
    RESET='\e[0m'
    echo -e ${COLOR} "$1" ${RESET}
}

# Install Latest "Chrome for Testing" Browser
INFO 'Installing Latest "Chrome for Testing" Browser'
CHROME_URL=`curl -sS https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq -r '.channels.Stable.downloads.chrome[] | select(.platform=="linux64") | .url'`
rm -rf chrome-linux64.zip
wget $CHROME_URL
unzip chrome-linux64.zip
sudo rm -rf /opt/chrome-for-testing/
sudo mkdir -p /opt/chrome-for-testing/
sudo mv chrome-linux64 /opt/chrome-for-testing/
sudo ln -s /opt/chrome-for-testing/chrome /usr/bin/chrome

# Install Latest Chromedriver
INFO "Installing Latest Chromedriver"
CHROMEDRIVER_URL=`curl -sS https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform=="linux64") | .url'`
rm -rf chromedriver-linux64.zip
wget $CHROMEDRIVER_URL
unzip chromedriver-linux64.zip
sudo mv chromedriver-linux64/chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
rm -rf chromedriver-linux64 chromedriver-linux64.zip

# Download Selenium Server
INFO "Download selenium-server-4.18.1.jar"
curl -LO https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.18.0/selenium-server-4.18.1.jar

Here is the URL to get the latest Chromedriver and Chrome for Testing from: https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.