Internet Explorer does not close via the selenium script with each solution

advertisements

I am Not able to close the Internet Explorer via selenium script, I tried every Solution to Kill the IEDriver task and Iexplorer.exe.

I also Tried solution: Internet Explorer 11 does not close after Selenium Test 2 but it still not working for me. I am Using below, Selenium 3.4, IE: 11.1358.14393.0, InternetExplorerServerDriver: 3.4.0

Below is my code.

import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class Tc03_IEDriver_First_use {
public static void main(String[] args) throws Exception {

        //Set IEDriver Properties
        System.setProperty("webdriver.ie.driver", "D:\\Rohit Bhatkar\\Selenium Jars\\IEDriverServer_x64_3.4.0\\IEDriverServer.exe");
        //Set desired Capabilities of IE. these statements removes an zoomsetting error.
        //You Can set Zoom mannually as, Go To View Menu on IE > Click On Zoom > Select 100%
        DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
        caps.setCapability("ignoreZoomSetting", true);
        //Create IEDriver obj, Open Browser, Open URL, Close the Browser
        WebDriver obj1= new InternetExplorerDriver(caps);
        obj1.manage().window().maximize();
        obj1.get("https://www.google.com");
        obj1.quit(); //IE not Closing. Steel need to do some work to close the browser

    }
}


Your code seems to work fine. I tested it and the IE browser closed at the end.

Try obj1.close(); instead of obj1.quit();