Skip to content
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

Closed
wants to merge 19 commits into from
Closed

Selenium 4: Ruby bindings #6444

wants to merge 19 commits into from

Conversation

p0deje
Copy link
Member

@p0deje 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. Deprecate what used to work.
  • 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 (added in 96998d9).
  • Implement Edge::Options (added in 4b0296f).
  • Allow to pass Options classes to remote instances (added in 92f4ed8).
  • 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). This is postponed until Se5.
  • Consider adding CDP (Java implementation of DevTools API #6667)

Ruby-specific

  • Deprecate Selenium::WebDriver namespace in favor of Selenium. Agree not to do this.
  • 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) Postponed.
  • Go through YARD docs and add missing.
  • Use safe-navigation operator where needed (&.)
  • Use squiggly heredoc instead of manually de-indented ones
  • Check why we need Safari::Service#binary_path
  • Check all TODOs

This change is Reviewable

@p0deje p0deje added the C-rb label Sep 25, 2018
@p0deje p0deje force-pushed the rb-selenium-4 branch 2 times, most recently from 6a02b11 to 7f36a17 Compare September 25, 2018 12:38
@twalpole
Copy link
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

@p0deje
Copy link
Member Author

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
It will be removed in Selenium 4. Use PortProber.above(port) instead.

Related to #6444
@p0deje p0deje force-pushed the rb-selenium-4 branch 2 times, most recently from 6c6b00d to b1a8627 Compare January 10, 2019 04:27
@luke-hill
Copy link
Contributor

@p0deje for when you move / CP the commits into here I've tackled the following.

  • Remove Mouse
  • Remove Keyboard
    (In doing so I removed the legacy ActionBuilder as well)
  • Removed a couple of the legacy Touch Driver Extensions (The others I couldn't work out which were consumed)
  • Cleared a couple of TODO's up.
  • Removed all references to OSS where I could find them deprecated
  • Altered all references to existing OSS to a deprecated version (Only exception was the Bridge stuff for Edge/IE)

@p0deje p0deje force-pushed the rb-selenium-4 branch 2 times, most recently from d228f6f to 7e91f8b Compare March 9, 2019 02:44
@p0deje p0deje force-pushed the rb-selenium-4 branch 9 times, most recently from 31cd801 to 6b67335 Compare April 12, 2019 09:46
p0deje added 4 commits April 17, 2019 21:24
This commit marks the end of old JSON Wire Protocol dialect support. It
is replaced by W3C dialect described by WebDriver specification. We used
to support both dialects by figuring out which one to use dynamically
(so-called "protocol handshake"), but Selenium 4 only supports W3C
specification. Things mostly work fine, though bugs are expected at the
edges since this commit includes major changes.

Please note that certain drivers don't properly support W3C yet. The
current state is the following:

* Firefox works fine via GeckoDriver
* Chrome works (mostly) fine via ChromeDriver with W3C mode turned on
* IE works fine via IEDriverServer
* Safari works fine via SafariDriver
* Edge doesn't work since it responds with OSS dialect
* PhantomJS doesn't work since it has always spoken only OSS dialect
* Remote equivalents, when used via Selenium server, work similarly
  to the described above.

OSS dialect: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol.
W3C dialect: https://w3c.github.io/webdriver.
It has been deprecated since Selenium 3.6 and is not W3C specification
compliant.
Selenium 4 only supports W3C dialect, so legacy Firefox driver should be
gone.
This commit is a part of a broader initiative to remove OSS dialect. In
theory, all the drivers will comply to W3C WebDriver specification and
support the implementation.
p0deje and others added 15 commits April 17, 2019 21:24
As a part of initiative to remove OSS dialect and support only W3C, all
the errors not compliant to specification  were removed. It seems like
server/grid passes through all the errors from drivers without altering
them (with the only exception of custom error when trying to upload
multiple files to server using POST /se/file - it's handled just fine
by Ruby bindings).
This was only directly called in the HasTouchScreen DriverExtension in 1 instantiation; and as such isn't used that much across the suite

Integration tests that relied on Double Forms of this class have just been modified to use the string representation

Signed-off-by: Alex Rodionov <[email protected]>
@p0deje
Copy link
Member Author

p0deje commented Apr 24, 2019

This is now in master, so no need to maintain PR.

@p0deje p0deje deleted the rb-selenium-4 branch April 24, 2019 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants