Created
October 21, 2011 13:46
-
-
Save mcornell/1303885 to your computer and use it in GitHub Desktop.
Monkey Patching Selenium's Firefox Timeout Condition in Watir-Webdriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if WEBDRIVER && BROWSER_TYPE == :firefox | |
module Selenium | |
module WebDriver | |
module SearchContext | |
def find_element(*args) | |
how, what = extract_args(args) | |
unless by = FINDERS[how.to_sym] | |
raise ArgumentError, "cannot find element by #{how.inspect}" | |
end | |
bridge.find_element_by by, what.to_s, ref | |
rescue Selenium::WebDriver::Error::InvalidSelectorError => e | |
e.message =~ /nsIDOMXPathEvaluator.createNSResolver/ ? retry : raise | |
end | |
def find_elements(*args) | |
how, what = extract_args(args) | |
unless by = FINDERS[how.to_sym] | |
raise ArgumentError, "cannot find elements by #{how.inspect}" | |
end | |
bridge.find_elements_by by, what.to_s, ref | |
rescue Selenium::WebDriver::Error::InvalidSelectorError => e | |
e.message =~ /nsIDOMXPathEvaluator.createNSResolver/ ? retry : raise | |
end | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The given selector ".//h1 is either invalid or does not resultin a Webelement. The following error occurred: | |
[InvalidSelectorError] Unable to locate elements with the xpath expression .//h1 because of the following error: | |
[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMXPathEvaluator.createNSResolver]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource://fxdriver/modules/atoms.js :: <TOP_LEVEL> :: line 2360" data: no] (Selenium::WebDriver::Error::InvalidSelectorError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment