Skip to content

Instantly share code, notes, and snippets.

@titusfortner
Last active December 25, 2023 17:20
Show Gist options
  • Save titusfortner/aec103e9b02709f771497fdb8b21154c to your computer and use it in GitHub Desktop.
Save titusfortner/aec103e9b02709f771497fdb8b21154c to your computer and use it in GitHub Desktop.
Current Instructions for Selenium Dev Environment on Windows

Update

The most recent instructions are now on the Selenium readme: https://github.com/SeleniumHQ/selenium/blob/trunk/README.md#installing

Outdated instructions

  • Windows Settings - turn on "Developer mode."
  • Run PowerShell As Administrator
  • Change execution policy: Set-ExecutionPolicy Unrestricted
  • Install chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  • Install git: choco install git
  • Install Java: choco install openjdk11
  • Install Bazelisk: choco install bazelisk
  • Install Msys2: choco install msys2 --params "/InstallDir=C:\tools\msys64"
  • Install Visual Studio:
  • Add System Environment Variables:
    • Add to PATH value "C:\tools\msys64\usr\bin"`
    • Set BAZEL_SH to "C:\tools\msys64\usr\bin\bash.exe"
    • Set BAZEL_VC to "C:\Program Files\Microsoft Visual Studio\2022\Community\VC" (this might be in x86 folder instead)
    • Set BAZEL_VC_FULL_VERSION to version of command line tools; find the directory name inside $BAZEL_VC/Tools/MSVC directory; Make sure to use this and not the version Visual Studio says it installed
  • Restart Computer
  • Open Developer Command Prompt for Visual Studio 2022
  • Create a projects directory & run git clone https://github.com/SeleniumHQ/selenium
  • Change directory: cd selenium
  • Test Build: bazel build //dotnet/test/common:chrome
  • Run Tests:
    • cd dotnet
    • dotnet test test/common/WebDriver.Common.Tests.csproj --framework net6.0
    • set ACTIVE_DRIVER_CONFIG=Firefox
    • dotnet test test/common/WebDriver.Common.Tests.csproj --framework net6.0
@xyziven
Copy link

xyziven commented Dec 25, 2023

I'm not able to create symlink when execute the command "bazel build //dotnet/test/common:chrome". The file apple_rules_lint with version 0.3.2.tar.gz is actually downloaded to C:\Users<user>_bazel_Hobin\3h4r744v\external\apple_rules_lint\temp4940371202000673584.

C:\Users<user>\Documents\selenium>bazel build //dotnet/test/common:chrome
INFO: Repository apple_rules_lint instantiated at:
C:/users//documents/selenium/WORKSPACE:7:13: in
Repository rule http_archive defined at:
C:/users//_bazel_hobin/ep2vbwzd/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in
INFO: repository @apple_rules_lint' used the following cache hits instead of downloading the corresponding file.

  • Hash '7c3cc45a95e3ef6fbc484a4234789a027e11519f454df63cbb963ac499f103f9' for https://github.com/apple/apple_rules_lint/archive/refs/tags/0.3.2.tar.gz
    If the definition of 'repository @apple_rules_lint' was updated, verify that the hashes were also updated.
    ERROR: An error occurred during the fetch of repository 'apple_rules_lint':
    Traceback (most recent call last):
    File "C:/users//_bazel_hobin/ep2vbwzd/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
    download_info = ctx.download_and_extract(
    Error in download_and_extract: java.io.IOException: Error extracting C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint/temp12861043901534462284/0.3.2.tar.gz to C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint/temp12861043901534462284: Cannot create symlink (name=C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint\example.bazelversion, target=C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): ERROR: src/main/native/windows/file-jni.cc(140): nativeCreateSymlink(\?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint\example.bazelversion, \?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): ERROR: src/main/native/windows/file.cc(523): CreateSymlink(\?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): createSymbolicLinkW failed
    ERROR: C:/users//documents/selenium/WORKSPACE:7:13: fetching http_archive rule //external:apple_rules_lint: Traceback (most recent call last):
    File "C:/users//_bazel_hobin/ep2vbwzd/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
    download_info = ctx.download_and_extract(
    Error in download_and_extract: java.io.IOException: Error extracting C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint/temp12861043901534462284/0.3.2.tar.gz to C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint/temp12861043901534462284: Cannot create symlink (name=C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint\example.bazelversion, target=C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): ERROR: src/main/native/windows/file-jni.cc(140): nativeCreateSymlink(\?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint\example.bazelversion, \?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): ERROR: src/main/native/windows/file.cc(523): CreateSymlink(\?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): createSymbolicLinkW failed
    ERROR: Error computing the main repository mapping: no such package '@apple_rules_lint//lint': java.io.IOException: Error extracting C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint/temp12861043901534462284/0.3.2.tar.gz to C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint/temp12861043901534462284: Cannot create symlink (name=C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint\example.bazelversion, target=C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): ERROR: src/main/native/windows/file-jni.cc(140): nativeCreateSymlink(\?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint\example.bazelversion, \?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): ERROR: src/main/native/windows/file.cc(523): CreateSymlink(\?\C:\users<user>_bazel_hobin\ep2vbwzd\external\apple_rules_lint.bazelversion): createSymbolicLinkW failed
    Loading:
    Fetching C:/users//_bazel_hobin/ep2vbwzd/external/apple_rules_lint; Extracting 0.3.2.tar.gz

@titusfortner
Copy link
Author

I've updated the official selenium readme with the latest instructions,
Please follow that one instead

https://github.com/SeleniumHQ/selenium/blob/trunk/README.md#installing
I even created a powershell script you can use.

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