Alrighty then, here we go.
$_ composer require behat/mink-selenium2-driver --dev
ChromeDriver is the more stable alternative to SeleniumDriver. While SeleniumDriver is more capable than ChromeDriver and supports multiple browsers – ChromeDriver aims to deliver testing against only one browser – Chrome. This makes the driver a lot more stable than Selenium because it has a lot less to worry about. Fortunately for me – since I work with automated pipelines, all I care about is stability. This also offers the added bonus of being super fast – Why not then?
Two ways to get ChromeDriver quickly.
1) Download from the website http://chromedriver.chromium.org/downloads. Pay attention to the version of Chrome the driver supports and make sure you’ve got that version running.
2) Use composer to pull down the version for your OS.
$_ composer require enm1989/chromedriver
If you’re using the composer.json file from behat 101, then you’d get the binary vendor/bin/chromedriver.
Lets assume you’ve got it through composer, run the binary to fire up ChromeDriver so it starts listening to instruction we’ll send out later on using behat.
You should get something like this
Starting ChromeDriver 2.32.498537 (cb2f855cbc7b82e20387eaf9a43f6b99b6105061) on port 9515 Only local connections are allowed.
At this point, your terminal window is engaged so open up a new one leaving this one as is.
Brilliant. We’re all set. Now lets write our first test. Create a new feature file called in hello-js.feature in the features folder outside of the bootstrap folder.
$_ touch features/hello-js.feature
Then write the following in this feature file. Pretty much the same as our first exercise, just tag the script with the
Viola! Run the test now and be amazed!
$_ vendor/bin/behat features/hello-js.feature