This is a
Summary
I ran into an error trying to start Chrome on Android, where an exception was being thrown in set_implicit_wait_by_default in lib/appium_lib_core/driver.rb:231, but because of the malformed raise statement, an unhelpful TypeError: exception class/object expected was raised instead
Environment
ruby_lib_core version: 1.9.0
- Mobile platform/version/device under test: Android 8.0, Chrome
Actual behaviour and steps to reproduce
Raised TypeError: exception class/object expected when trying to initialize driver to launch Chrome on Android. (Will not enumerate full reproduction steps here, as the base error is raised by the Appium server when trying to set the implicit wait probably for other reasons. However the way this error is handled and re-raised inside set_implicit_wait_by_default is incorrect.
The raise statements should be fixed to put the error message after the class:
def set_implicit_wait_by_default(wait)
@driver.manage.timeouts.implicit_wait = wait
rescue ::Selenium::WebDriver::Error::UnknownError => e
unless e.message.include?('The operation requested is not yet implemented')
# This is incorrect
# raise e.message, ::Appium::Core::Error::ServerError
# Error class should come first
raise ::Appium::Core::Error::ServerError, e.message
end
Appium::Logger.debug(e.message)
{}
rescue ::Selenium::WebDriver::Error::WebDriverError => e
# FIXME: Temporary rescue until Appium support W3C's implicit wait
# https://github.com/jlipps/simple-wd-spec#set-timeouts
unless e.message.include?('Parameters were incorrect. We wanted {"required":["type","ms"]} and you sent ["implicit"]')
# same here
# raise e.message, ::Appium::Core::Error::ServerError
raise ::Appium::Core::Error::ServerError, e.message
end
Appium::Logger.debug(e.message)
{}
end
Expected behaviour
Should raise the actual error returned by the Appium server
Link to Appium/Ruby logs
Create a GIST which is a paste of your full Appium logs, and link them here.
Any additional comments
This is a
Summary
I ran into an error trying to start Chrome on Android, where an exception was being thrown in
set_implicit_wait_by_defaultinlib/appium_lib_core/driver.rb:231, but because of the malformedraisestatement, an unhelpfulTypeError: exception class/object expectedwas raised insteadEnvironment
ruby_lib_coreversion: 1.9.0Actual behaviour and steps to reproduce
Raised
TypeError: exception class/object expectedwhen trying to initialize driver to launch Chrome on Android. (Will not enumerate full reproduction steps here, as the base error is raised by the Appium server when trying to set the implicit wait probably for other reasons. However the way this error is handled and re-raised insideset_implicit_wait_by_defaultis incorrect.The
raisestatements should be fixed to put the error message after the class:Expected behaviour
Should raise the actual error returned by the Appium server
Link to Appium/Ruby logs
Create a GIST which is a paste of your full Appium logs, and link them here.
Any additional comments