Configure PhantomJS GhostDriver With Eclipse To Run WebDriver Test

Earlier we learnt how to execute WebDriver test In headless browser(Browser not visible during test case execution) using HTMLUnit driver In THIS POST with practical example. Same thing we can do using PhantomJS GhostDriver. It Is WebKit which Is headless and scriptable with javascript
API. You can read more about PhantomJS on THIS PAGE. Here I will describe you PhantomJs configuration steps with eclipse and next post will tell you how to execute WebDriver test case on PhantomJS headless browser which Is not visible during test case execution.

Steps to configure PhantomJS GhostDriver with eclipse

Step 1 : Download phantomjs.exe In zip format
First of all you need to download executable "phantomjs.exe" file's zip folder for windows. Go to THIS PAGE and click on "" link for windows as shown In bellow Image. It will start downloading the folder.

Step 2 : Extract Zip folder
When completed download, You need to extract zip folder to get executable "phantomjs.exe" file. When you extract zip folder, There will be bin folder Inside It and you will get "phantomjs.exe" file In that bin folder as shown In bellow Image.

Step 3 : Download phantomjsdriver-1.2.1.jar file
You need "phantomjsdriver-1.2.1.jar" file. Go to THIS PAGE and click on phantomjsdriver-1.2.1.jar link to download It.

Step 4 : Add phantomjsdriver-1.2.1.jar file In project's build path
"phantomjsdriver-1.1.0.jar" file will be already available In your projects build path as It Is comes with WebDriver jar files. But If you will execute your WebDriver test on PhantomJS GhostDriver using 1.1.0 version then you will get error like bellow.

java.lang.NoClassDefFoundError: org/openqa/selenium/browserlaunchers/Proxies

To resolve this error, you need to remove "phantomjsdriver-1.1.0.jar" file from project's build path and add "phantomjsdriver-1.2.1.jar" file In project's build path. Latest version will resolve your error. Now configuration part of PhantomJS with eclipse Is over. Next post will describe you how to execute test In headless browser.

1 comment:

  1. Spent a day and half to find out solution for "java.lang.NoClassDefFoundError: org/openqa/selenium/browserlaunchers/Proxies:" error. Thanks a lot for this blog