When attempting to load the page, HtmlUnit throws an exception and crashes my test.
caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => caps)
driver.navigate.то url
ReferenceError: "x" is not defined. (net.sourceforge.htmlunit.corejs.javascript.EcmaError)
No errors occur when using a Firefox driver.
caps = Selenium::WebDriver::Remote::Capabilities.firefox
You can also resolve this issue by disabling JavaScript for the HtmlUnit driver.
caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => false)
If you are unable to modify the code on the test page to fix the problem, you may need to either ignore it or find a way to utilize the Firefox JavaScript Engine instead of the default HtmlUnit JavaScript Engine.
Is there a solution that does not involve changing the test page's code?
Update: I attempted using Capybara + WebKit as an alternative to Selenium + HtmlUnit, which worked fine without any errors. However, I still prefer to address the issue without switching frameworks.