如何解决Headless_ie_driver启动Internet Explorer时发生意外错误IELaunchURL返回HRESULT 80070012“没有其他文件”
您所看到的错误说明了一切:
selenium.common.exceptions.SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:65393/'
如果您访问Release Page
的 的Release
Notes
为
它明确提到了以下情况:
- 支持Firefox和Chrome
- 无头桌面不再启动Windows资源管理器。
- 创建无头桌面后,desktop_utils.exe学会了不运行explorer.exe。
因此,无法使用 *
更新:
按您的评论Are there any alternatives to open IE and run it in background via
selenium with mouse/keyboard inputs
直Answer
是 。
他还补充说:
解决方法
我正在尝试运行一个简单的无头Web浏览器;
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Ie("headless_ie_selenium.exe")
driver.get("www.google.com")
print(driver.title)
我得到:
selenium.common.exceptions.SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:65393/'
我试过但没用的东西:
1:
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = DesiredCapabilities.INTERNETEXPLORER.copy()
caps['ie.ensureCleanSession']= True
driver = webdriver.Ie("headless_ie_selenium.exe",capabilities=caps)
2:所有Internet选项安全设置处于同一级别,并且都选中了“启用保护模式”;
3:搜索要删除的C:\ Program文件夹,但是没有任何内容。
注意 :相同的代码对于普通的网络驱动程序(IEDriverServer.exe)可以正常工作,当我手动打开
headless_ie_selenium.exe时 ,它将启动:
Selenium driver found at: path..\IEDriverServer.exe
Started InternetExplorerDriver server (32-bit)
3.8.0.0