Selenium Server Automation - 对象不支持属性或方法'attachEvent'

时间:2014-02-03 20:30:38

标签: c# javascript selenium selenium-rc ui-automation

我正在尝试使用Selenium Server和IE 11运行自动化。 当我使用selenium.Start()启动ISelenium对象时,它会抛出一个javascript错误“对象不支持属性或方法'attachEvent'”。

文件路径C:/Users/rlodha/AppData/Local/Temp/1/customProfileDir4d38c1e69384462995bae8b5362fd3b8/core/scripts/selenium-browserbot.js

这是我的代码

public ISelenium selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com");
            selenium.Start();  //this line is throwing error
            selenium.Open("http://www.google.com");

我使用最低安全设置运行IE 11。

3 个答案:

答案 0 :(得分:0)

实际上没有为IE浏览器找到任何解决方案,但我切换到Firefox浏览器并且没有再次遇到此错误。

答案 1 :(得分:0)

Selenium(特别是 RC)不支持IE11。这是您的问题的基础。要么降级IE,要么使用其他浏览器。

答案 2 :(得分:0)

<script language="javascript">

if (typeof UserAgentInfo.strBrowser !== 'undefined'  && !window.addEventListener) {
    UserAgentInfo.strBrowser=1;
}
</script>
相关问题