New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium 4: Ruby bindings #6444

Open
wants to merge 10 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@p0deje
Member

p0deje commented Sep 25, 2018

This PR is opened for the list of changes I'd like to do for Ruby bindings in Selenium 4. Please read below for details and I'll be happy to hear the feedback. Let's have this PR both as To Do list and discussion board + code of what we want to see in Selenium 4. I'll be updating the list throughout the implementation and discussion.

I'll be very happy to hear the feedback from everyone else involved in selenium-webdriver gem development (@titusfortner, @lmtierney, @twalpole). If something is not clear or doesn't make any sense or causes trouble for higher-level libraries (Watir, Capybara) - let's discuss here.

Removal of OSS dialect

  • Remove deprecated Mouse class.
  • Remove deprecated Keyboard class.
  • Remove all OSS -> W3C capabilities conversion and aliases.
  • Convert all W3CSometimg classes to Something. Remove their OSS equivalents.
  • Change API for timeouts.
  • Remove protocol handshake.
  • Rename desired_capabilities to capabilities and provide W3C-compliant API for setting then (alwaysMatch, firstMatch).

Cleanup

  • Remove Firefox legacy driver support.
  • Remove PhantomJS code (or extract to standalone gem) (?).
  • Go through all the driver extensions and drop the ones that no longer make any sense.

Improvements

  • Implement automatic driver extensions loading based on returned capabilities (it should have been there all the time).
  • Implement Safari::Options.
  • Implement Edge::Options.
  • Allow to pass Options classes to remote instances.
  • Allow to pass custom Service instances to driver in favor of driver_opts. Deprecate driver_opts. (?)
  • Use element/{element id}/attribute/{name} to get element instead of atom (confirm with Simon).

Ruby-specific

  • Deprecate Selenium::WebDriver namespace in favor of Selenium. (?)
  • Require minimum Ruby version to 2.3 (EOL is in March) (https://www.ruby-lang.org/en/downloads/branches/).
  • Address all C-rb issues (somehow).
  • Address all C-rb pull requests (somehow).
  • Remove JRuby-specific SocketPoller#listening? as the bug it works around has been fixed in JRuby 1.6.7 (http://jruby.org/2012/02/22/jruby-1-6-7).
  • Remove any custom code that checks for defined RUBY_ENGINE as it was only undefined in MRI 1.8 (also search for similar constants).
  • Check if we still need custom logic for getting HOME directory on JRuby.
  • Remove anything related to IronRuby - it’s not developed anymore.
  • Simplify Platform#null_device as File::NULL was introduced in Ruby 1.9.3 (https://svn.ruby-lang.org/repos/ruby/tags/v1_9_3_0/NEWS).
  • Drop all the execution via $PROGRAM_NAME == __FILE__ - use IRB instead.
  • Properly handle Windows/Unix path separators using File::ALT_SEPARATOR whenever possible.
  • Remove all the compatibility layer for old Ruby in Logger .
  • Remove PortProber.random as it should be avoided (deprecated in 6d3edb5).
  • Rework Wait to use Process::CLOCK_MONOTONIC instead of Time as the latter is often monkey-patched (e.g. Timecop).
  • Deprecate and extract all custom HTTP clients (curb/persistent) (?).
  • Go through YARD docs and add missing.
  • Use safe-navigation operator where needed (&.)

This change is Reviewable

@p0deje p0deje added the C-rb label Sep 25, 2018

@twalpole

This comment has been minimized.

Show comment
Hide comment
@twalpole

twalpole Sep 25, 2018

Contributor

This all sounds fine to me other than the deprecating of the Selenium::WebDriver namespace - that's going to make exception handling while supporting selenium-webdriver 3 and 4 in Capybara a pain

Contributor

twalpole commented Sep 25, 2018

This all sounds fine to me other than the deprecating of the Selenium::WebDriver namespace - that's going to make exception handling while supporting selenium-webdriver 3 and 4 in Capybara a pain

@p0deje

This comment has been minimized.

Show comment
Hide comment
@p0deje

p0deje Sep 26, 2018

Member

This all sounds fine to me other than the deprecating of the Selenium::WebDriver namespace - that's going to make exception handling while supporting selenium-webdriver 3 and 4 in Capybara a pain

Fair enough. We might just not do that or find a way to make it work for Capybara painlessly. @titusfortner proposed this, so maybe he has an opinion on that.

Member

p0deje commented Sep 26, 2018

This all sounds fine to me other than the deprecating of the Selenium::WebDriver namespace - that's going to make exception handling while supporting selenium-webdriver 3 and 4 in Capybara a pain

Fair enough. We might just not do that or find a way to make it work for Capybara painlessly. @titusfortner proposed this, so maybe he has an opinion on that.

p0deje added a commit that referenced this pull request Sep 28, 2018

Deprecate PortProber.random as it's not guaranteed to work correctly
It will be removed in Selenium 4. Use PortProber.above(port) instead.

Related to #6444

p0deje added some commits Sep 25, 2018

Require Ruby 2.3 at the very least
All previous Ruby versions are no longer supported while 2.3 EOL is
March 2019.
Remove JRuby-specific SocketPoller#listening?
The bug it worked around has been fixed in JRuby 1.6.7
(http://jruby.org/2012/02/22/jruby-1-6-7)
Ignore the case when RUBY_ENGINE is undefined
This happened on MRI 1.8 which we no longer support
Simply Platform#null_device to just use File::NULL
It was introduced in Ruby 1.9.3 way older that our minimum required version
(https://svn.ruby-lang.org/repos/ruby/tags/v1_9_3_0/NEWS)
Remove WebDriver::Logger compatibility layer for Ruby 2.2 and older
Ruby 2.3 is minimum required version in Selenium 4
Remove self-executable Ruby scripts
Rather than running those directly, use IRB.

Mentioned IE + FFI + MRI issue no longer reproduces on Win 10 + IE11 +
MRI 2.3.
Calculate time using Process::CLOCK_MONOTONIC rather than Time.now
Some gems (Timecop in particular) mock Time class causing failures for
our timeout-like loops. With this change, we now use more low-level API
introduced in MRI 2.1 to get monotonic clock. This API gives a bit
different results on POSIX vs Windows, but consistent enough for our
needs. JRuby also supports this for years.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment