0

I am trying to run my automation on azure devops environment and phantomjs driver is getting timedout with below error message, can someone please help in resolving this problem

2019-10-30T16:13:27.8547904Z verifyXXXXActionPanel(com.xx.xxx.xxxxxxxx.tests.Dashboard.Testxxxxxxx) Time elapsed: 20.01 sec <<< FAILURE! 2019-10-30T16:13:27.8547948Z org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. 2019-10-30T16:13:27.8606707Z Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 2019-10-30T16:13:27.8607855Z System info: host: '495c34b84843', ip: '172.17.42.5', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1055-azure', java.version: '1.8.0_191' 2019-10-30T16:13:27.8607969Z Driver info: driver.version: PhantomJSDriver 2019-10-30T16:13:27.8608049Z at java.util.concurrent.FutureTask.get(FutureTask.java:205) 2019-10-30T16:13:27.8608497Z at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:154) 2019-10-30T16:13:27.8608567Z at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80) 2019-10-30T16:13:27.8608609Z at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:177) 2019-10-30T16:13:27.8608650Z at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:168) 2019-10-30T16:13:27.8608709Z at org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.execute(PhantomJSCommandExecutor.java:78) 2019-10-30T16:13:27.8608751Z at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) 2019-10-30T16:13:27.8608792Z at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241) 2019-10-30T16:13:27.8608850Z at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128) 2019-10-30T16:13:27.8608901Z at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:141) 2019-10-30T16:13:27.8608947Z at org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:115) 2019-10-30T16:13:27.8608987Z at org.openqa.selenium.phantomjs.PhantomJSDriver.(PhantomJSDriver.java:104) 2019-10-30T16:13:27.8609047Z at com.wm.bua.corpcreditcard.driverFactory.BrowserFactory.getWebDriver(BrowserFactory.java:195) 2019-10-30T16:13:27.8609088Z at com.wm.bua.corpcreditcard.driverFactory.BrowserFactory.getBrowser(BrowserFactory.java:61) 2019-10-30T16:13:27.8609129Z at com.wm.bua.corpcreditcard.tests.Dashboard.TestCorpCardManager.verifyManagerActionPanel(TestCorpCardManager.java:147)

below are the DesiredCapabilities which I tried using when trying to launch phantomjs driver

ClassLoader classLoader = new BrowserFactory().getClass().getClassLoader();
        File phantomJS = new File(classLoader.getResource("drivers/phantomjs").getFile());
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,phantomJS.getAbsolutePath());
        String[] cli_args = new String[]{ "--ssl-protocol=tlsv1", "--ignore-ssl-errors=true", "--web-security=false" };
        capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, "--webdriver-loglevel=ERROR");
        capabilities.setCapability("takesScreenshot", false);
        capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cli_args);
        capabilities.setCapability("locationContextEnabled", true);
        capabilities.setCapability("applicationCacheEnabled", true);
        capabilities.setCapability("browserConnectionEnabled", true);
        capabilities.setCapability("localToRemoteUrlAccessEnabled", true);
WebDriver driver = new PhantomJSDriver(capabilities);
Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92
  • 1
    PhantomJs is deprecated. All major browser vendors allow you to start the browser without a window (headless mode). I would use one of the new web drivers instead. – Greg Burghardt Oct 30 '19 at 22:09

1 Answers1

0

Phantomjs usage is deprecated. You are using selenium3

The above error occurs may be selenium version may be incompatible to phantomjs driver try a compatible version maybe it works

But I recommend you to go with Chrome headless

I think the existing stack post will help you https://stackoverflow.com/a/36769777/12167800