selenium-webdriver 4.0 不显示异常消息

selenium-webdriver 4.0 not showing Exception MEssages

我将 Selenium 与 Capybara 和 Cucumber 一起使用 运行 在 Ruby Mine 中针对 Chrome 浏览器进行自动化测试。我已经将 selenium-webdriver 更新到 4.0.0.alpha5 版本(以前的版本是 3.13.1),之后我发现在访问 Capybary 函数时会发生一些异常,当这个错误发生时,我总是收到此消息:

NameError: uninitialized constant Selenium::WebDriver::Error::UnhandledError

我预计会出现一些与文档中未找到的元素相关的错误或任何有意义的原因,此消息阻止解决代码中的潜在问题。

如何避免这条消息?是否需要进行任何错误配置才能正确捕获异常?

-- 编辑--

堆栈跟踪:

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'

assertPageTitle 方法在此行失败

if pageFocus.has_selector?('span.highcharts-title')

我已经通过更新水豚gem到目前的最新版本(3.33.0)解决了这个问题,在此之前,我一直在测试3.10.1版本。更新后,之前的错误不再出现,当我在测试中强行出错时,我收到了来自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