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

Does not use Chrome on Windows on WSLv2 #196

Merged
merged 3 commits into from
Jan 14, 2021

Conversation

fabioxgn
Copy link
Contributor

@fabioxgn fabioxgn commented Jan 9, 2021

Fixes #192

This PR #187 changed WSL detection to detect both WSLv1 and WSLv2 as running in WSL and use Chrome on Windows for both versions. But it doesn't work on WSLv2 out of the box.

WSL2 networking is different from WSL1 and you can't connect from the WSL2 Linux on Chromedriver running on Windows using 127.0.0.1:9515, see: microsoft/WSL#4619

This PR changes the wsl detection to be explicity about v1 and only uses Chromedriver on Windows if it is WSLv1, as it doesn't work on WSLv2.

@urubatan
Copy link

This PR will also close #197

@kapoorlakshya
Copy link
Collaborator

@fabioxgn Thank you for this PR! Just to confirm, this PR will:

  • Stop webdrivers from finding Chrome binary on the Windows filesystem when using WSLv2. WSLv2 will be treated as Linux and only the Chrome binary on the Linux filesystem will be detected.
  • Chrome on both the Windows and Linux filesystem will continue to be found on WSLv1. So no change from the current behavior (v4.4.2) here.

Is that correct?

@urubatan Have you already tested this PR to confirm #197 will get fixed? Would like to be sure before we close both #192 and #197 when this PR gets merged.

@fabioxgn
Copy link
Contributor Author

@fabioxgn Thank you for this PR! Just to confirm, this PR will:

  • Stop webdrivers from finding Chrome binary on the Windows filesystem when using WSLv2. WSLv2 will be treated as Linux and only the Chrome binary on the Linux filesystem will be detected.
  • Chrome on both the Windows and Linux filesystem will continue to be found on WSLv1. So no change from the current behavior (v4.4.2) here.

Is that correct?

Exactly 👍

@urubatan
Copy link

I just tested and the PR do not fix the issue

@fabioxgn
Copy link
Contributor Author

I just tested and the PR do not fix the issue

What cat /proc/version returns when running on Docker with WSL2?

@urubatan
Copy link

I just tested and the PR do not fix the issue

What cat /proc/version returns when running on Docker with WSL2?

cat /proc/version
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020

I found a resource (https://askubuntu.com/questions/1177729/wsl-am-i-running-version-1-or-version-2)
saying that a sure way to check WSL v2 is to check if the linux version is 4.19 or above, I'm writing a PR with this in mind

@fabioxgn
Copy link
Contributor Author

fabioxgn commented Jan 13, 2021

I just tested and the PR do not fix the issue

What cat /proc/version returns when running on Docker with WSL2?

cat /proc/version
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020

I found a resource (https://askubuntu.com/questions/1177729/wsl-am-i-running-version-1-or-version-2)
saying that a sure way to check WSL v2 is to check if the linux version is 4.19 or above, I'm writing a PR with this in mind

But with that output, it should work with this PR. Did you test with the wsl2 branch of my fork or with the master branch? See: https://github.com/titusfortner/webdrivers/pull/196/files#diff-c208b3bc55384e84ed6c4fc43d0a40f066e79fc93ce3825cfa0b946ad8aaa96aR153

It should detect your system as Linux and not WSL as microsoft did not return with caption M.

@urubatan
Copy link

@fabioxgn and @titusfortner my bad, the PR works, I pointed my Gemfile to @fabioxgn master branch, not to his wsl2 branch.

Sorry for the mistake, please merge this PR and ignore mine;

PS.: @fabioxgn might be a good idea to include the "false WSL test" check in your PR line this one
urubatan@c801b14#diff-ac7f784131a2d9a0da98400f0909e0ab274625c5ca268516e24e98c4bcb46201R5

@fabioxgn
Copy link
Contributor Author

fabioxgn commented Jan 13, 2021

@fabioxgn and @titusfortner my bad, the PR works, I pointed my Gemfile to @fabioxgn master branch, not to his wsl2 branch.

Sorry for the mistake, please merge this PR and ignore mine;

PS.: @fabioxgn might be a good idea to include the "false WSL test" check in your PR line this one
urubatan@c801b14#diff-ac7f784131a2d9a0da98400f0909e0ab274625c5ca268516e24e98c4bcb46201R5

@urubatan There's a test for this: https://github.com/titusfortner/webdrivers/pull/196/files#diff-ac7f784131a2d9a0da98400f0909e0ab274625c5ca268516e24e98c4bcb46201R27

But my PR uses the word "Microsoft" to detect if is wsl1, as in wsl2 it is lowercase.

@kapoorlakshya
Copy link
Collaborator

@fabioxgn @urubatan Perfect! Thanks for confirming.

I'm closing #199 and merging this.

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

Successfully merging this pull request may close these issues.

Can't find Chrome Binary in WSL2 with version 4.4.2
3 participants