1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, certifi
5, geckodriver
6, pytestCheckHook
7, pythonOlder
8, trio
9, trio-websocket
10, urllib3
11, nixosTests
12}:
13
14buildPythonPackage rec {
15 pname = "selenium";
16 version = "4.6.0";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "SeleniumHQ";
23 repo = "selenium";
24 # check if there is a newer tag with or without -python suffix
25 rev = "refs/tags/selenium-${version}";
26 hash = "sha256-xgGGtJo+DZIwPa0H6dsT0VClRTMM8iFbNzSDZjH7ImI=";
27 };
28
29 postPatch = ''
30 substituteInPlace py/selenium/webdriver/firefox/service.py \
31 --replace 'DEFAULT_EXECUTABLE_PATH = "geckodriver"' 'DEFAULT_EXECUTABLE_PATH = "${geckodriver}/bin/geckodriver"'
32 '';
33
34 preConfigure = ''
35 cd py
36 '';
37
38 propagatedBuildInputs = [
39 certifi
40 trio
41 trio-websocket
42 urllib3
43 ] ++ urllib3.optional-dependencies.socks;
44
45 checkInputs = [
46 pytestCheckHook
47 ];
48
49 passthru.tests = {
50 testing-vaultwarden = nixosTests.vaultwarden;
51 };
52
53 meta = with lib; {
54 description = "Bindings for Selenium WebDriver";
55 homepage = "https://selenium.dev/";
56 license = licenses.asl20;
57 maintainers = with maintainers; [ jraygauthier SuperSandro2000 ];
58 };
59}