Selenium Webdriver Python启动Internet Explorer时出现意外错误。 IELaunchURL()返回HRESULT 80070012

时间:2015-08-07 15:18:02

标签: python-2.7 selenium selenium-webdriver

我的Selenium Python Selenium Webdriver脚本运行但有时它们不运行,它是间歇性的。 我收到错误:启动Internet Explorer时出现意外错误。 IELaunchURL()返回了网址“http://localhost:50540/”的HRESULT 80070012(“没有更多文件。”)

    Error
Traceback (most recent call last):
  File "C:\Webdriver\ClearCore 501\TestCases\VariablesPage_TestCase.py", line 35, in setUp
    self.driver = webdriver.Ie(Globals.IEdriver_path)
  File "C:\Python27\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 55, in __init__
    desired_capabilities=capabilities)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 87, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 136, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 196, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:50540/'

我如何克服这种间歇性问题? 我必须单击运行大约5次,然后测试用例最终将运行

这是我的Python Webdriver代码,它从我的一个测试用例启动浏览器:

def setUp(self):

    webdriver.DesiredCapabilities.INTERNETEXPLORER["unexpectedAlertBehaviour"] = "accept"
    self.driver = webdriver.Ie(Globals.IEdriver_path)
    self.driver.get(Globals.URL_justin_pc)
    self.login_page = login.LoginPage(self.driver)
    self.driver.implicitly_wait(100)

所有区域的互联网安全选项,未选中复选框以启用保护模式。所有区域的级别都设置为“中”。

0 个答案:

没有答案