1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
{
lib,
fetchFromGitHub,
buildPythonPackage,
selenium-manager,
certifi,
pytestCheckHook,
pythonOlder,
trio,
trio-websocket,
typing-extensions,
urllib3,
pytest-trio,
nixosTests,
stdenv,
python,
}:
buildPythonPackage rec {
pname = "selenium";
version = "4.18.1";
format = "setuptools";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "SeleniumHQ";
repo = "selenium";
# check if there is a newer tag with or without -python suffix
rev = "refs/tags/selenium-${version}";
hash = "sha256-1C9Epsk9rFlShxHGGzbWl6smrMzPn2h3yCWlzUIMpY8=";
};
preConfigure = ''
cd py
'';
postInstall =
''
DST_PREFIX=$out/${python.sitePackages}/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
ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/macos/
''
+ lib.optionalString stdenv.isLinux ''
mkdir -p $DST_PREFIX/common/linux/
ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/linux/
'';
propagatedBuildInputs = [
certifi
trio
trio-websocket
urllib3
typing-extensions
] ++ urllib3.optional-dependencies.socks;
nativeCheckInputs = [
pytestCheckHook
pytest-trio
];
__darwinAllowLocalNetworking = true;
passthru.tests = {
testing-vaultwarden = nixosTests.vaultwarden;
};
meta = with lib; {
description = "Bindings for Selenium WebDriver";
homepage = "https://selenium.dev/";
license = licenses.asl20;
maintainers = with maintainers; [ jraygauthier ];
};
}
|