I am using Selenium with Capybara and Cucumber to run automated tests in Ruby Mine against a Chrome browser. I have updated the selenium-webdriver to the 4.0.0.alpha5 version (the former version was 3.13.1) and after that I have found that some exceptions are happening when accessing to the Capybary functions, when this errors happen, I am always getting this message:
NameError: uninitialized constant Selenium::WebDriver::Error::UnhandledError
I would expect some error related fo an element not found in the document or any meaningful reason, this message is preventing to solve the underlying problems in the code.
How can this message be avoided? Is there any Error configuration that needs to be done in order to catch the exception correctly?
-- EDIT --
Stack trace:
NameError: uninitialized constant Selenium::WebDriver::Error::UnhandledError
./features/step_definitions/dspFramework_steps/navigation.rb:314:in `assertPageTitle'
./features/step_definitions/dspFramework_steps/navigation.rb:293:in `/^I assert that the page's title is( not)? "([^"]*)"/'
./features/step_definitions/dspFramework_steps/common_steps.rb:260:in `/^I click the site logo$/'
./features/dspApps_features/DSPCommon_features/DSPCommon_Add_DebugLog_CustomWebapp.feature:23:in `Then I click the site logo'
The assertPageTitle method fails in this line
if pageFocus.has_selector?('span.highcharts-title')
I have fixed the problem by updating the capybara gem to the latest version at present (3.33.0), before that, I had been testing with the version 3.10.1. After the update, the previous error has no longer happened and when I have forced an error in the test, I have recived a correct error message from Capybara:
Capybara::ExpectationNotMet: expected to find css ".detailtable" within #<Capybara::Node::Element tag="div" path="/HTML/BODY[1]/DIV[1]/DIV[2]/DIV[3]/DIV[1]"> at least 1 time but there were no matches