Selenium Webdriver 鼠标
我正在尝试用 Ruby 为 Firefox Webdriver 构建一个鼠标:到目前为止还没有成功。
@driver = Selenium::WebDriver.for :firefox, :profile => profile
@mouse = Selenium::WebDriver::Mouse.new(@driver)
@mouse.click(@driver.find_element :css => 'li:nth-child(1)')
错误的回溯
test_add_course(ItemAutocompleteTest):
NoMethodError: undefined method
mouseMoveTo for #<Selenium::WebDriver::Driver:0x7fa66e372b18 browser=:firefox>
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/mouse.rb:50:in move_to
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/mouse.rb:60:in move_if_needed
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/mouse.rb:12:in click
test/selenium_2/item_autocomplete_test.rb:36:in test_add_course
mocha (0.9.8) lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in __send__
mocha (0.9.8) lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in run
1 tests, 0 assertions, 0 failures, 1 errors
在这里我发现了类似的问题 https://gist.github.com/967333
感谢您的任何建议!
I am trying to build a mouse for Firefox Webdriver in Ruby: no success so far.
@driver = Selenium::WebDriver.for :firefox, :profile => profile
@mouse = Selenium::WebDriver::Mouse.new(@driver)
@mouse.click(@driver.find_element :css => 'li:nth-child(1)')
Traceback of the mistake
test_add_course(ItemAutocompleteTest):
NoMethodError: undefined method
mouseMoveTo for #<Selenium::WebDriver::Driver:0x7fa66e372b18 browser=:firefox>
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/mouse.rb:50:in move_to
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/mouse.rb:60:in move_if_needed
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.1/lib/selenium/webdriver/common/mouse.rb:12:in click
test/selenium_2/item_autocomplete_test.rb:36:in test_add_course
mocha (0.9.8) lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in __send__
mocha (0.9.8) lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in run
1 tests, 0 assertions, 0 failures, 1 errors
Here I found the similar problem
https://gist.github.com/967333
Thank you for any suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您会注意到 Mouse 类 被标记为私有在文档中 - 它不是公共 API 的一部分。要使用高级用户交互,您需要查看 ActionBuilder< /a> 相反,基本上:
我将在 wiki 中添加有关此内容的部分页面。
You'll notice the Mouse class is marked as private in the docs - it's not part of the public API. To use the advanced user interactions, you want to look at the ActionBuilder instead, basically:
I'll add a section about this to the wiki page.