You can find my version of the server at
http://teddyb.org/~rlpowell/media/public/selenium-local/selenium-server-standalone-2.0b3-rlpowell-1.jar
*NOTE*: To use the x and y parameters on moveto with the Ruby
bindings you must either pull the latest bindings out of trunk or
apply this patch:
--- /tmp/builder.rb 2011-05-08 23:44:34.000000000 -0700
+++ /opt/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/selenium/webdriver/common/action_builder.rb 2011-05-08 23:44:37.000000000 -0700
@@ -87,7 +87,7 @@
end
def perform
- @actions.each { |receiver, method, *args|
+ @actions.each { |receiver, method, args|
@devices.fetch(receiver).__send__(method, *args)
}
end
to your local action_builder.rb (it just adds a * in front of args
in the pattern match). Otherwise all movement will be to the center
of the given element, and if no element is given it will just fail
utterly.
Example of use, hovering, in Ruby (with the patch):
describe 'hover test' do
it "should load the remote driver" do
# FIXME: Maybe increase this timeout
@driver.manage.timeouts.implicit_wait = 5 # seconds
@driver.class.name.should == "Selenium::WebDriver::Driver"
end
it "should load" do
@driver.navigate.to "http://www.webdesignerwall.com/demo/jquery/animated-hover1.html"
end
it "should hover over the first one and wait for a bit" do
wait_for_user();
e=@driver.find_element(:xpath, "//a[text()='Web Designer Wall']")
@driver.action.move_to(e).perform
sleep 2
end
it "should hover over the second one *via the first one* and wait for a bit" do
e=@driver.find_element(:xpath, "//a[text()='Web Designer Wall']")
@driver.action.move_to(e, 200, 0).perform
sleep 2
end
end
Example of use, mouse up and mouse down, in Ruby (with the patch):
describe 'mousedown test' do
it "should load the remote driver" do
# FIXME: Maybe increase this timeout
@driver.manage.timeouts.implicit_wait = 5 # seconds
@driver.class.name.should == "Selenium::WebDriver::Driver"
end
it "should do some stuff" do
@driver.navigate.to "http://www.javascripter.net/faq/onmoused.htm"
e=@driver.find_element(:xpath, "//img[@name='imgName']/..")
@driver.action.click_and_hold(e).perform;
sleep 2
@driver.action.release(e).perform;
end
end
Note that using these same scripts, mousedown (i.e. click_and_hold)
doesn't seem to work on IE, so there's a problem with browser
compatibility there; hopefully someone will fix that. Or maybe it
does work, but it just works for only an instant, which is what
happens with mouseover on IE; I can't really tell.
-Robin
--
http://singinst.org/ : Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei". My personal page: http://www.digitalkingdom.org/rlp/