How to launch PhantomJS driver using Desired Capability?

0 votes
How to launch PhantomJS driver using Desired Capability?
Jul 15 in Selenium by Usha
39 views

1 answer to this question.

0 votes

Hey usha, to launch PhantomJS driver using Desired Capabilities in Selenium, you can use this code snippet:

public static void main(String[] args) {

            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.setJavascriptEnabled(true);

            capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "C://phantomjs.exe");

            capabilities.setCapability("takesScreenshot", true);

            WebDriver driver = new PhantomJSDriver(capabilities);

            driver.get("https://www.google.com");

            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

            String title = driver.getTitle();

            System.out.println(title);

    }
answered Jul 15 by Anvi
• 13,960 points

Related Questions In Selenium

+1 vote
1 answer
0 votes
3 answers
0 votes
1 answer
0 votes
1 answer

How to run test scripts in Selenium using PhantomJS?

Hey @Shushil, you can run your test ...READ MORE

answered May 17 in Selenium by Abha
• 27,180 points
66 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
976 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
1,131 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
873 views
0 votes
1 answer

How to launch browsers using Python-Selenium?

Hey Nikita, to launch browser in Python-Selenium, ...READ MORE

answered May 24 in Selenium by Anvi
• 13,960 points
38 views
0 votes
1 answer