0

I'm new to test automation and using Ruby capybara with the selenium driver.

I want to automate this page

Here, I want to click the file menu inside the applet for that I did following but it is not working

browser = Capybara.current_session.driver.browser
w=browser.find_element(:id,"editlive").style("width")

h=browser.find_element(:id,"editlive").style("height")
browser.action.move_by(w.to_i,h.to_i).click.perform 
Guilherme Franco
  • 1,465
  • 12
  • 19
Sush
  • 1,449
  • 8
  • 26
  • 51

1 Answers1

0

The primary use case for Capybara is interacting with the HTML dom. Clicking on a link can be as easy as click_on "text of link"

But it sounds like you are not clicking on a regulary HTML link - instead you are trying to interact with a Java applet. Capybara + Selenium cannot (seemingly) interact with applets[1].

However the same thread suggests investigating these alternatives which may provide a solution.

  • AutoIt + Selenium
  • Sikuli + Selenium
  • Fest

If you do want to continue with Capybara, what you've alluded to with move_to is part of the Capybara Mouse private API. They advise against using it - but it might be the only way to interact with a non-dom element.

You might have better luck using "move_to" with an offset driver.mouse.move_to(element, H - x, W - y) where x and y are arbitrary numbers to get your cursor to the appropriate spot on the browser.

Other tools that might help you are: firebug to debug your specs in the browser and Capybara.execute_script which will let you execute arbitrary javascript if you need to get really low level.

[1] https://groups.google.com/forum/#!topic/selenium-users/0tgVaZog4UE

mkirk
  • 3,965
  • 1
  • 26
  • 37