【发布时间】:2020-08-31 05:03:07
【问题描述】:
我们目前正在研究将 Selenium 作为嵌入在一系列控制器中的 Web 服务器的测试工具。我希望为所有驱动程序重用相同的 Python (2.7) 代码,但尽管 Chrome 和 Firefox 运行良好,但 IE11(惊喜?)不喜欢它。 IE 打开,但 Python 抛出异常。
起初我以为问题只是 URL 中包含的 user:pwd...
driver.get("http://" + "acc:acc@10.169.89.97")
但是即使在删除登录信息并手动输入登录后,后续代码...
(driver.switch_to.frame("links_frame")
然后也失败了。
驱动程序之间是否存在一些差异会导致这种情况?我读过其他人成功地为所有浏览器重用相同的代码,所以我必须弄清楚我可能做错了什么?
详情:
首先……
...第 25 行,在 driver.get("http://" + "acc:acc@10.169.89.97")
...\webdriver.py",第 185 行,在 get self.execute(Command.GET, {'url': url})
...webdriver.py",第 173 行,在执行 self.error_handler.check_response(response) ...\errorhandler.py",第 164 行,在 check_response 中引发 exception_class(message, screen, stacktrace) selenium.common.exceptions。 WebDriverException:消息:您无法导航到 acc:acc@10.169.89.97。这通常意味着对 COM 方法 IWebBrowser2::Navigate2() 的调用失败。'
在第二种情况下:
...第 33 行,在 driver.switch_to.frame("links_frame") # 选择包含下一个元素的 iframe 进行测试 ...\webdriver\remote\switch_to.py",第 64 行,在帧 self._driver.execute (Command.SWITCH_TO_FRAME, {'id': frame_reference})
...\webdriver.py",第 173 行,在执行 self.error_handler.check_response(response)
...\webdriver\remote\errorhandler.py", line 164, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.UnexpectedAlertPresentException: Message: u'Modal dialog present' – –
【问题讨论】:
-
如何你的代码失败了?
-
@MickM 您在 cmets 中输入的信息属于您的问题。请编辑您的问题,使其包含这些错误消息,并格式化它们以便于阅读。
标签: python internet-explorer selenium webdriver