Search code examples
javaseleniumselenium-webdriverphantomjsghostdriver

Starting with Phantomjs driver


Can anyone suggest me good documentations or steps to start or configure phantomJs driver in java so that i can run my test cases in remote server.


Solution

  • I run the selenium server in grid mode then connect the phantomjs to it after it is up as it doesn't try to reconnect if it disconnects or isn't fully up

    ./phantomjs --webdriver=5558 --webdriver-selenium-grid-hub=http://localhost:4444
    

    which will have it listen on port 5558 (for example) but you connect through selenium an it appears as browser phantomjs on Any platform

    Steps

    java -jar selenium-server-standalone-2.14.0.jar -role hub 
    
    ./phantomjs --webdriver=5558 --webdriver-selenium-grid-hub=http://localhost:4444
    

    You can then run tests as per the selenium web site https://code.google.com/p/selenium/wiki/Grid2

    I use perl to run tests http://metacpan.org/pod/Selenium::Remote::Driver but there are many choices