0

I am writting automatic test for GWT application. And I try to double click on table element. I am using this code fo click:

browser.element(:xpath, '/html/body/div[5]/div[2]/div/div/div/div[2]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/table/tbody[2]/tr[1]/td[1]/div').double_click

When this command is executed I get error like:

test_search(TC_article_example):Selenium::WebDriver::Error::InvalidElementStateError: Cannot perform native interaction: Could not load native events component.

[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/fxdriver@googlecode.com/components/driver_component.js:8577:in `generateErrorForNativeEvents'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/fxdriver@googlecode.com/components/driver_component.js:8610:in `FirefoxDriver.prototype.mouseMove'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/fxdriver@googlecode.com/components/command_processor.js:10275:in `DelayedCommand.prototype.executeInternal_/h'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/fxdriver@googlecode.com/components/command_processor.js:10280:in `DelayedCommand.prototype.executeInternal_'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/fxdriver@googlecode.com/components/command_processor.js:10220:in `DelayedCommand.prototype.execute/<'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/bridge.rb:616:in `raw_execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/bridge.rb:594:in `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/bridge.rb:389:in `mouseMoveTo'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/mouse.rb:54:in `move_to'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/action_builder.rb:344:in `block in perform'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/action_builder.rb:343:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/action_builder.rb:343:in `perform'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-webdriver/elements/element.rb:181:in `hover'
C:/Watir/polisy.rb:27:in `test_search'

I have added this code to my script but this didn't help:

profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = false
browser = Watir::Browser.new :firefox, :profile => profile

Please give me some tip. I use selenium 2.31, watir 4.0 and firefox 19.0.2. PS: Sorry for my english.

Chuck van der Linden
  • 6,660
  • 2
  • 28
  • 43
user2239655
  • 830
  • 2
  • 11
  • 28
  • Can you show us the html in the area of the thing you are trying to click? – Chuck van der Linden Apr 05 '13 at 01:26
  • Is there a page with sample code that uses this same GWT thing? or uses similar controls to what you are using? without HTML or better yet a site to look at, it's hard at this point to suggest many alternatives. – Chuck van der Linden Apr 05 '13 at 16:37
  • You CANNOT be using watir 4.0 you must be using some flavor of watir-webdriver in order to support Firefox. Can you please include the version of watir-wevdriver and also the version of webdriver that are being used? Most especially, since your FF version is very recent, ensure the webdriver stuff is up to date. – Chuck van der Linden Apr 05 '13 at 16:40

1 Answers1

0

The error sounds like it wants native events, and you are disallowing them. try changing the profile setting for native events to true

Also ditch the ugly, brittle, impossible to read xpath. Watir has far more readable, less brittle ways to identify the div you are trying to click.

Start a new question, include some of the HTML for the table where that div lives, the logic for how you are picking it (surely it relates to the content of the table? not just second cell of the second row of the third tablebody) and we can give you some advice on how to better select the element that will result in code that makes sense and is readable, won't break if the table contents change slightly, and won't break at the slightest re-design of the page.

Chuck van der Linden
  • 6,660
  • 2
  • 28
  • 43
  • I set profile.native_events to true. But this nothing changed. Xpath may not be the most beautiful but it work. If i use simple click, then tr is selected. Only the method double_click don't work. I don't know why. If function double_click work then I will repair my xpaths. – user2239655 Apr 04 '13 at 07:41
  • have you tried using `.fire_event("ondblclick") instead to see if that works? that would use javascript events instead of native events, and might work? – Chuck van der Linden Apr 05 '13 at 01:35
  • Yes I have tried and then I haven't no errors but it didn't work. The row is focused but nothingelse. I have tried to install older browser and selenium. Still It doesn't work – user2239655 Apr 05 '13 at 07:19