It is not always obvious the root cause of errors in Selenium.
The most common Selenium-related error is a result of poor synchronization.
Read about Waiting Strategies. If you aren’t sure if it
is a synchronization strategy you can try temporarily hard coding a large sleep
where you see the issue, and you’ll know if adding an explicit wait can help.
Note that many errors that get reported to the project are actually caused by
issues in the underlying drivers that Selenium sends the commands to. You can rule
out a driver problem by executing the command in multiple browsers.
If you have questions about how to do things, check out the Support options
for ways get assistance.
If you think you’ve found a problem with Selenium code, go ahead and file a
Bug Report
on GitHub.
The basic levels for the Ruby logger are: :debug, :info, :warn, :error, :fatal
Selenium uses :info and :debug similar to “verbose” and “very verbose”, so the default
is :warn.
To change the level of the logger:
Selenium::WebDriver.logger.level=:fatal
WARN
Warnings include everything we want users to be aware of by default. This is mostly used
for deprecations. For various reasons, Selenium project does not follow standard Semantic Versioning practices.
Our policy is to mark things as deprecated for 3 releases and then remove them.
As such, Ruby logs deprecations as warnings, specifying what is changing, what needs to be
used instead. It may include additional messages, and always includes an ID.
For example:
2022-12-24 16:07:09 WARN Selenium [DEPRECATION] [:jwp_caps] `Capabilities#version=` is deprecated. Use `Capabilities#browser_version=` instead.
Because these items can get annoying, we’ve provided an easy way to turn them off.
To turn off a specific warning, set the ID to ignore:
This is where the most useful information gets logged. Selenium logs the endpoints and payloads
sent to and received from the driver or server. This is a great way to see what Selenium is actually
doing under the hood, and can be used to determine if it is Selenium code or driver code that
is causing a problem. (Unfortunately, we can’t blame the driver if Selenium is sending incorrect syntax).
DEBUG
This is less useful information where we log things about the servers and the sockets, and header information, etc.
Debug mode is set if either $DEBUG is true or ENV['DEBUG'] has a value.
Content Help
Note:
This section needs additional and/or updated content
Descriptions of how to set and use logging in Java, Python, JavaScript, and .NET