0

所以我在 Windows XP 上,我试图让 watir-webdriver 运行 Internet Explorer 8。我已经将 IEDriverServer.exe 添加到 cygwin 的 /bin 中。我还暂时禁用了 Windows 防火墙和杀毒软件,但仍然收到此错误消息。

w = Watir::Browser.new :ie 
#=>
Errno::EPERM: Operation not permitted - bind(2)
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:28:in `initialize' from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:28:in `new'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:28:in `block in free?' rom /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:26:in `each'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:26:in `free?'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/port_prober.rb:5:in `above'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/ie/bridge.rb:18:in `block in initialize'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/ie/bridge.rb:18:in `delete'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/ie/bridge.rb:18:in `initialize'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/driver.rb:35:in `new'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/driver.rb:35:in `for'
from /usr/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver.rb:67:in `for'
from /usr/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-webdriver/browser.rb:46:in `initialize'
from (irb):3:in `new'

请注意,我第一次运行该程序时,虽然它立即崩溃并显示相同的错误消息,但我从 Windows 收到一个对话框,询问我是否要阻止某些操作。我告诉它“解锁”该动作。

4

1 回答 1

1

看来您的 IE 配置文件有问题,最好删除 IE 并重新安装它,然后尝试使用您的代码调用浏览器,它应该可以工作。或者尝试更新也可以修复浏览器的IE。

于 2013-04-01T11:02:14.547 回答