1
votes

So I'm making an automated test with codeception. It was working well using phpbrowser, but the page I want to test uses ajax so I changed to webdriver, following the instructions on the codeception website.

I chose to use chromedriver since I'm only going to be doing this test with chrome, but it's giving me back this error

Acceptance Tests (1) ---------------------------------------------------------------------------------------------------
FirstCest: Login successfully
Signature: FirstCest:loginSuccessfully
Test: tests\acceptance\FirstCest.php:loginSuccessfully
Scenario --
 ERROR

------------------------------------------------------------------------------------------------------------------------


Time: 722 ms, Memory: 8.00 MB

There was 1 error:

---------
1) FirstCest: Login successfully
 Test  tests\acceptance\FirstCest.php:loginSuccessfully

  [Facebook\WebDriver\Exception\WebDriverException] JSON decoding of remote response failed.
Error code: 4
The response: 'unknown command: wd/hub/session'


#1  D:\Programas\xampp\htdocs\autTest\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:298
#2  D:\Programas\xampp\htdocs\autTest\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:126
#3  D:\Programas\xampp\htdocs\autTest\vendor\symfony\event-dispatcher\EventDispatcher.php:212
#4  D:\Programas\xampp\htdocs\autTest\vendor\symfony\event-dispatcher\EventDispatcher.php:44

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

I tried changing the chromedriver.exe to the installation path of chrome but it's still the same. I really don't know how to configure the url for chromedriver since it only came as an .exe.

This is my acceptance suite in codeception just in case:

actor: AcceptanceTester
modules:
      enabled:
        - WebDriver:
             url: 'http://localhost/ASTechOLE/login.php'
             window_size: false # disabled in ChromeDriver
             port: 9515
             browser: chrome
             capabilities:
                 "goog:chromeOptions": # additional chrome options
        - \Helper\Acceptance

Thanks in advance

Update: I ran chromedriver with ./chromedriver --url-base=/wd/hub Now it gives me

There was 1 error:

---------
1) FirstCest: Login successfully
 Test  tests\acceptance\FirstCest.php:loginSuccessfully

  [Facebook\WebDriver\Exception\WebDriverException] JSON decoding of remote response failed.
Error code: 4
The response: 'unhandled request'


#1  D:\Programas\xampp\htdocs\autTest\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:298
#2  D:\Programas\xampp\htdocs\autTest\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:126
#3  D:\Programas\xampp\htdocs\autTest\vendor\symfony\event-dispatcher\EventDispatcher.php:212
#4  D:\Programas\xampp\htdocs\autTest\vendor\symfony\event-dispatcher\EventDispatcher.php:44

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

1

1 Answers

2
votes

Based on your stacktrace, it seems that you are working in Windows. Try running the chromedriver without leading trailing slash, wd/hub instead of /wd/hub.
Your command then becomes: ./chromedriver --url-base=wd/hub.
I know, Windows can be "fun" sometimes :)