【问题标题】:Not able to launch IE from selenium Webdriver [duplicate]无法从 selenium Webdriver 启动 IE [重复]
【发布时间】:2020-07-17 13:11:30
【问题描述】:

当我尝试从 selenium 代码启动 IE 时出现此错误。

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 800700C1 ('%1 is not a valid Win32 application.') for URL 'http://localhost:4593/'

代码

public class Simple {

    public static void main(String[] args) throws IOException {

    System.setProperty("webdriver.ie.driver", "./UpdateSyncRate/Library/drivers/IEDriverServer.exe");

        WebDriver driver = new InternetExplorerDriver();
        
        driver.manage().deleteAllCookies();
        driver.get(URL);
        driver.manage().window().maximize();
    }
}

【问题讨论】:

    标签: selenium


    【解决方案1】:

    %1 not a valid win32 application 让我觉得你的 exe 有问题。可能是错误的版本或错误的版本?

    看看WebDriverManager

    它可以在运行时为您完成,而不是手动下载和映射驱动程序:

    WebDriverManager.iedriver().setup();
    WebDriver driver = new InternetExplorerDriver();
    

    你可以做更多的选择。看看他们的文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-18
      • 2016-11-08
      • 1970-01-01
      • 2015-02-28
      • 1970-01-01
      • 1970-01-01
      • 2019-09-21
      相关资源
      最近更新 更多