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

msedgedriver support #93

Closed
titusfortner opened this issue May 5, 2019 · 11 comments
Closed

msedgedriver support #93

titusfortner opened this issue May 5, 2019 · 11 comments

Comments

@titusfortner
Copy link
Owner

Need to figure out the right way to support the new chromium backed for Edge. Not sure if this will require selenium 4, or if we can release it as party of webdrivers 4.0

@twalpole
Copy link
Collaborator

twalpole commented Jun 7, 2019

PR #128

@twalpole
Copy link
Collaborator

twalpole commented Jun 25, 2019

This is implemented for Windows and Mac currently via b34aec2. There is no support for linux yet since there is no linux version of edge available yet. Windows and Mac edge binary locations will also need to be updated once release versions of the browser become available and we know what they will be named.

@kapoorlakshya
Copy link
Collaborator

kapoorlakshya commented Jun 26, 2019

@twalpole I am testing the rake task for msedgedriver and the update task with and without a required version is failing on Windows. I get the same results with Webdrivers::Edgedriver.update.

Attempt 1 with latest Dev build

$ bundle exec rake webdrivers:edgedriver:update
rake aborted!
Webdrivers::VersionError: Unable to find latest point release version for 77.0.197. You appear to be using a non-production version of Edge. Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` to a known edgedriver version: https://devel
oper.microsoft.com/en-us/microsoft-edge/tools/webdriver/
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/edgedriver.rb:43:in `latest_point_release'
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/chromedriver.rb:34:in `block in latest_version'

#... rest of the log

This is not a bug in our code. Looks like Microsoft is not listing a driver for 77.0.197.x on the downloads page for some reason.

Not sure how we should handle this case.

Attempt 2 with latest Canary build

$ bundle exec rake webdrivers:edgedriver:update WD_EDGE_CHROME_PATH="C:\Users\Lakshya Kapoor\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe"
rake aborted!
Webdrivers::VersionError: Unable to find latest point release version for 77.0.201. You appear to be using a non-production version of Edge. Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` to a known edgedriver version: https://devel
oper.microsoft.com/en-us/microsoft-edge/tools/webdriver/
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/edgedriver.rb:43:in `latest_point_release'
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/chromedriver.rb:34:in `block in latest_version'

#... rest of the log

This version is listed on the downloads page as of 06/25, so maybe the HTML changed recently?

Attempt 3 with required version

Fails for same reason as attempt 2.

$ bundle exec rake webdrivers:edgedriver:update[77.0.201.0]
rake aborted!
TypeError: no implicit conversion of nil into String
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/system.rb:63:in `basename'
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/system.rb:63:in `download_file'
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/system.rb:55:in `download'
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/common.rb:95:in `update'
C:/Users/Lakshya Kapoor/RubymineProjects/webdrivers/lib/webdrivers/tasks/edgedriver.rake:23:in `block (3 levels) in <top (required)>'
Tasks: TOP => webdrivers:edgedriver:update
(See full trace by running task with --trace)

Seems like either the download page by Microsoft is unreliable (for this purpose) or they're not planning to exactly match the browser and driver versions. Their main page doesn't list older releases, which is understandable, but then their "full" download directory here does not list the latest releases. What the heck? (Apparently, there is a page 2 with more versions)

Just wanted to check with you before I release v4.1.0. You can check out the rake tasks in my release_4.1.0 branch if you want.

@kapoorlakshya
Copy link
Collaborator

kapoorlakshya commented Jun 26, 2019

Looks like we can provide the full browser version to this link:

https://msedgedriver.azureedge.net/77.0.190.1/edgedriver_win32.zip
https://msedgedriver.azureedge.net/77.0.190.1/edgedriver_win64.zip
https://msedgedriver.azureedge.net/77.0.190.1/edgedriver_mac64.zip

and get access to zips for all versions , even the ones not listed in the full version directory.

This way we can avoid parsing the HTML and fix the issues described in my previous comment.

@twalpole
Copy link
Collaborator

twalpole commented Jul 1, 2019

I've updated this to use the newer URLs. There is an issue in that Microsoft isn't currently (don't know if they will) LATEST_RELEASE_X_Y_Z files like Google does. They're only doing LATEST_RELEASE_X as of now. This means that currently with edge it only requires to match X. This could be an issue if a later version of the major version driver won't work with a previous release of that same major version browser. I guess we'll see.

@twalpole
Copy link
Collaborator

twalpole commented Jul 1, 2019

And of course I just noticed the Appveyor builds are failing on this with the string "Driver_Notes" coming from somewhere????

@kapoorlakshya
Copy link
Collaborator

@twalpole Microsoft is apparently packaging some license info in a folder titled Driver_Notes within the zip. This folder is getting extracted with the binary and an attempt to delete it using File.delete via System.delete is failing on line 125 here:

zip_file.each do |f|
@top_path ||= f.name
f_path = File.join(Dir.pwd, f.name)
delete(f_path)
FileUtils.mkdir_p(File.dirname(f_path)) unless File.exist?(File.dirname(f_path))
zip_file.extract(f, f_path)

I was able to fix this by ignoring folders in System.unzip_file and only extracting the files:

zip_file.each do |f|
  next if f.ftype == :directory

Another interesting thing to note is that the Driver_Notes folder only exists in the zips for Windows. It does not exist in the mac64 package. I discovered this after being confused why specs on macOS were passing without this fix.

Anyway, I have pushed this change in #141. Feel free to suggest improvements.

@kapoorlakshya
Copy link
Collaborator

kapoorlakshya commented Jul 2, 2019

Well, I just noticed that this only fixes the initial problem by ignoring the folder itself (index 0), but still extracts the files inside the folder (index 1 and 2):

0> zip_file.map(&:name)
=> ["Driver_Notes/", "Driver_Notes/credits.html", "Driver_Notes/LICENSE", "msedgedriver.exe"]

This in turn creates .webdrivers/Driver_Notes/ as a result of FileUtils.mkdir_p which preserves the parent folder name.

Need to figure out a way to completely ignore folders and their content without hard coding folder names.

@twalpole
Copy link
Collaborator

twalpole commented Jul 2, 2019

I think we should be able to extract only the file we want rather than all of them

@twalpole
Copy link
Collaborator

twalpole commented Jul 2, 2019

@kapoorlakshya Along the lines of #142 (if it passes :) )

@kapoorlakshya
Copy link
Collaborator

Looks good! Will rebase my PR, merge, and release v4.1.0 tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants