summary refs log tree commit diff
path: root/pkgs/development/python-modules/selenium/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/selenium/default.nix')
-rw-r--r--pkgs/development/python-modules/selenium/default.nix30
1 files changed, 23 insertions, 7 deletions
diff --git a/pkgs/development/python-modules/selenium/default.nix b/pkgs/development/python-modules/selenium/default.nix
index 053b42d90e9..086c5310897 100644
--- a/pkgs/development/python-modules/selenium/default.nix
+++ b/pkgs/development/python-modules/selenium/default.nix
@@ -8,12 +8,15 @@
 , trio
 , trio-websocket
 , urllib3
+, pytest-trio
 , nixosTests
+, stdenv
+, python
 }:
 
 buildPythonPackage rec {
   pname = "selenium";
-  version = "4.8.0";
+  version = "4.14.0";
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
@@ -23,18 +26,30 @@ buildPythonPackage rec {
     repo = "selenium";
     # check if there is a newer tag with or without -python suffix
     rev = "refs/tags/selenium-${version}";
-    hash = "sha256-YTi6SNtTWuEPlQ3PTeis9osvtnWmZ7SRQbne9fefdco=";
+    hash = "sha256-cTMCKfFLUlJDbTUQA3Z/pKCE1RQQRMb4K8hKKn9HqvU=";
   };
 
-  postPatch = ''
-    substituteInPlace py/selenium/webdriver/firefox/service.py \
-      --replace 'DEFAULT_EXECUTABLE_PATH = "geckodriver"' 'DEFAULT_EXECUTABLE_PATH = "${geckodriver}/bin/geckodriver"'
-  '';
-
   preConfigure = ''
     cd py
   '';
 
+  postInstall = ''
+    DST_PREFIX=$out/lib/${python.libPrefix}/site-packages/selenium/webdriver/
+    DST_REMOTE=$DST_PREFIX/remote/
+    DST_FF=$DST_PREFIX/firefox
+    cp ../rb/lib/selenium/webdriver/atoms/getAttribute.js $DST_REMOTE
+    cp ../rb/lib/selenium/webdriver/atoms/isDisplayed.js $DST_REMOTE
+    cp ../rb/lib/selenium/webdriver/atoms/findElements.js $DST_REMOTE
+    cp ../javascript/cdp-support/mutation-listener.js $DST_REMOTE
+    cp ../third_party/js/selenium/webdriver.json $DST_FF/webdriver_prefs.json
+  '' + lib.optionalString stdenv.isDarwin ''
+    mkdir -p $DST_PREFIX/common/macos
+    cp ../common/manager/macos/selenium-manager $DST_PREFIX/common/macos
+  '' + lib.optionalString stdenv.isLinux ''
+    mkdir -p $DST_PREFIX/common/linux/
+    cp ../common/manager/linux/selenium-manager $DST_PREFIX/common/linux/
+  '';
+
   propagatedBuildInputs = [
     certifi
     trio
@@ -44,6 +59,7 @@ buildPythonPackage rec {
 
   nativeCheckInputs = [
     pytestCheckHook
+    pytest-trio
   ];
 
   passthru.tests = {