Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

We have multiple Windows Server 2012 machines setup on Google Cloud where we are running Selenium tests. They are running with Mocha in NodeJS. Chrome and Firefox are starting, running, and closing as expected but IE 11 will not close. As a result, the selenium server stops responding and all the tests in IE begin to fail.

Here is the code for my before and after each hooks

// Launches browser, opens homepage, and closes the popup.

exports.beforeEach = function(capability) {

   driver = utils.driver.launch(capability);

   utils.driver.open(driver);

   utils.driver.closePopup(driver);

}

exports.afterEach = function() {

  driver.quit();

}

The capabilities I have set are the following

{

  browserName: browser,

  version: version,

  screenResolution: resolution,

  requireWindowFocus: true,

  unexpectedAlertBehaviour: "dismiss",

  ignoreProtectedModeSettings: false,

  ignoreZoomSetting: false,

  nativeEvents: true,

  handlesAlerts: true,

  javascriptEnabled: true,

  enableElementCacheCleanup: true,

  cssSelectorsEnabled: true,

  usePerProcessProxy: false,

  elementScrollBehavior: 0,

  enablePersistentHover: false,

  pageLoadStrategy: "normal",

  ie: {

    ensureCleanSession: true,

    forceCreateProcessApi: true,

    browserCommandLineSwitches: "-private"

  }

}

I've searched around for a few days and have tried different combinations of driver.close(), driver.quit(), IE settings, and capability settings, but they haven't worked and I really don't know what else to try. Since IE is not closing it's making it practically impossible to test in that browser. After about three tests the server slows down and we have to login and close all the windows manually.

1 Answer

0 votes
by (62.9k points)

If we are not able to close the IE by webdriver commands and at this moment it is a stepping stone, so you can try this JAVA code to close the browser.

try { Runtime.getRuntime().exec("taskkill /F /IM IEDriverServer.exe"); } catch (IOException e) { e.printStackTrace(); }

Browse Categories

...