2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildPythonPackage,
|
|
|
|
selenium-manager,
|
|
|
|
certifi,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
trio,
|
|
|
|
trio-websocket,
|
|
|
|
typing-extensions,
|
2024-07-27 06:49:29 +00:00
|
|
|
websocket-client,
|
2024-06-05 15:53:02 +00:00
|
|
|
urllib3,
|
|
|
|
pytest-trio,
|
|
|
|
nixosTests,
|
|
|
|
stdenv,
|
|
|
|
python,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "selenium";
|
2024-10-11 05:15:48 +00:00
|
|
|
version = "4.24.0";
|
2022-11-21 17:40:18 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "SeleniumHQ";
|
|
|
|
repo = "selenium";
|
2022-10-21 18:38:19 +00:00
|
|
|
# check if there is a newer tag with or without -python suffix
|
|
|
|
rev = "refs/tags/selenium-${version}";
|
2024-10-11 05:15:48 +00:00
|
|
|
hash = "sha256-AsQr9kGv2dxkiFzptDA0D27OXZjYj7oDKz2oEQ2qW7s=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-10-11 05:15:48 +00:00
|
|
|
patches = [ ./dont-build-the-selenium-manager.patch ];
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
preConfigure = ''
|
|
|
|
cd py
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
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
|
|
|
|
''
|
2024-09-26 11:04:55 +00:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2024-06-05 15:53:02 +00:00
|
|
|
mkdir -p $DST_PREFIX/common/macos
|
|
|
|
ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/macos/
|
|
|
|
''
|
2024-09-26 11:04:55 +00:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-06-05 15:53:02 +00:00
|
|
|
mkdir -p $DST_PREFIX/common/linux/
|
|
|
|
ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/linux/
|
|
|
|
'';
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
certifi
|
2022-06-26 10:26:21 +00:00
|
|
|
trio
|
|
|
|
trio-websocket
|
|
|
|
urllib3
|
2024-04-21 15:54:59 +00:00
|
|
|
typing-extensions
|
2024-07-27 06:49:29 +00:00
|
|
|
websocket-client
|
2022-11-21 17:40:18 +00:00
|
|
|
] ++ urllib3.optional-dependencies.socks;
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-06-26 10:26:21 +00:00
|
|
|
pytestCheckHook
|
2023-11-16 04:20:00 +00:00
|
|
|
pytest-trio
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru.tests = {
|
2021-07-04 02:40:35 +00:00
|
|
|
testing-vaultwarden = nixosTests.vaultwarden;
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2022-06-26 10:26:21 +00:00
|
|
|
description = "Bindings for Selenium WebDriver";
|
|
|
|
homepage = "https://selenium.dev/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ jraygauthier ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|