1
votes

SOLUTION: I downgraded Firefox to version 27.01 and my test is now working again. Firefox 28.0 may have some native mouse move problems. I was receiving the same error when trying Richard's suggestions below.

PROBLEM: I have some basic code that was working last week but now it is not working. Not sure if my Firefox updated and is causing the issue or if this is bad programming and should not be done either way.

Here is part of my code.

require 'watir-webdriver'
require 'watir-webdriver/extensions/select_text'
require 'tiny_tds'

browser = Watir::Browser.new :firefox
browser.goto "http://localhost:42706/playerAddEdit/Create"

def self.createNewPlayer(playerInfo, browser)

  printf("%s3 createNewPlayer\n", playerInfo)
  playerInfo.each do |line|
     info = line.split(/,/)

     browser.text_field(:name => 'FName').set info[0]
     browser.text_field(:name => 'LName').set info[1]
     browser.text_field(:name => 'Handicap').set info[2]

     browser.button(:id => 'submit').hover
     browser.button(:id => 'submit').click

     browser.a(:text => "Create New").wait_until_present
     browser.a(:text => "Create New").click
     browser.input(:id => 'FName').wait_until_present
  end
end

The error occurs on the "browser.button(:id => 'submit').hover" line of code, which was working.

The error generated is partially: Selenium::WebDriver::Error::InvalidElementStateError: Cannot perform native interaction: Could not load native events component.

My questions are why would it stop working and is it bad practice to do this? I got in the habit of using hover when I was testing some dropdown's and it helped out. (If I comment out the .hover line everything works fine.)

1

1 Answers

1
votes

I think you can replace the hover line with this:

browser.action.move_to(browser.find_element(:id => "submit")).perform

Or replace the two lines with this:

browser.action.move_to(browser.find_element(:id => "submit")).click().perform