Unable to launch IE browser in selenium webdriver

前端 未结 7 1208
再見小時候
再見小時候 2020-12-31 22:08

I have written a sample code to launch IE browser and load google page.

public class Sample {

 public static void main(String[] args) 
  {
             


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 23:04

    package tests;
    
    import java.util.concurrent.TimeUnit;
    
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.ie.InternetExplorerDriver;
    
    public class Sample {
    
        public static void main(String[] args) {
            System.setProperty("webdriver.ie.driver","C:\\Automation Workspace\\ComplianceDashboardProject\\Vendor\\IEDriverServer.exe");
            WebDriver driver=new InternetExplorerDriver();
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
    
            driver.get("http://www.google.com");
            driver.quit();
        }
    }
    

    I did the above and got it to work. Maybe try moving your driver file to another location to make sure there isn't some security issue.

提交回复
热议问题