0

I'm trying to get a hidden element visible. I've tried every mouse event and element selector I can find in Watir. So I'm trying to use RAutomation code that's already within watir. But it seems ineffective.

require 'watir'
@browser = Watir::IE.new
@browser.goto 'samplesite.com'
@browser.rautomation.mouse.move({:x=>210,:y=240})

From this I get the browser to raise to the top, and the console replies nil. But the mouse hasn't moved. Then when I proceed to do

@browser.rautomation.mouse.click

I get a response of 2... which I take as a success of the click. I need to be able to move the mouse to this coordinate.

@browser.rautomation.adapter

returns => :win_32

Can I set it to :autoit in an already established instance of Watir?

Help please.

6ft Dan
  • 2,365
  • 1
  • 33
  • 46
  • I would highly encourage you to look further into what event needs to be triggered on what element for a user to make this hidden element visible. You may find this link very useful http://stackoverflow.com/questions/3787555/how-to-find-out-which-javascript-events-fired – anonygoose Sep 14 '12 at 15:08

1 Answers1

0

So, what you're saying is that the mouse does not move at all?

Try this code:

mouse = @browser.rautomation.mouse
puts mouse.position.inspect
mouse.move :x => 100, :y => 100
puts mouse.position.inspect

What is the output?

To use AutoIt adapter, you can do this:

mouse = RAutomation::Window.new(:adapter => :autoit, :hwnd => @browser.hwnd)
mouse.move :x => 100, :y => 100
Jarmo Pertman
  • 1,905
  • 1
  • 12
  • 19
  • Okay, I'm finding that the results with your details are same as Watir's built-in rautomation. But you have helped me figure out more. In both cases the mouse position is the absolute position to the operating system, and not the browser window. Which I can't use... not all IE's are created equal. It does move the position according to inspect and mouse.position. But the visible mouse doesn't move. Also in your second bit of code the object you create isn't mouse... because I need to exec mouse.mouse.move – 6ft Dan Oct 01 '12 at 22:11
  • ruby 1.8.7, watir (1.6.7), watir-webdriver (0.6.2) error - undefined method `rautomation' for # (NoMethodError) – stack1 Jun 30 '15 at 20:06
  • Try to upgrade your version of everything since they are really old :) – Jarmo Pertman Jul 02 '15 at 07:10