Skip to content

Commit

Permalink
Use new powershell if available to enhance WSL support (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Jun 19, 2020
1 parent 3cc3ada commit dd2336e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ The logging level can be configured for debugging purpose:
Webdrivers.logger.level = :DEBUG
```

### WSLv1 support

While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
in WSL, `webdrivers` will use the Windows `chromedriver.exe`.

It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
with the console font being changed when calling the old PowerShell (PS5).

### Browser Specific Notes

#### Chrome/Chromium
Expand Down
2 changes: 2 additions & 0 deletions lib/webdrivers/chrome_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def linux_location
end

def win_version(location)
System.call("pswh.exe -command \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
rescue StandardError
System.call("powershell.exe \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
end

Expand Down

0 comments on commit dd2336e

Please sign in to comment.