# How to fix selenium (python package) locally?

**URL:** https://discourse.nixos.org/t/how-to-fix-selenium-python-package-locally/23660
**Category:** Help
**Created:** [December 2, 2022, 1:51pm UTC](https://discourse.nixos.org/t/how-to-fix-selenium-python-package-locally/23660 "2022-12-02T13:51:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kvtb](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/k/ad7895/32.png) [@kvtb](https://discourse.nixos.org/u/kvtb)
#### Post date: [December 2, 2022, 1:51pm UTC](https://discourse.nixos.org/t/how-to-fix-selenium-python-package-locally/23660/1 "2022-12-02T13:51:56Z")

</div>

in NixOS 22.11 the selenium python package is broken.

There is already an issue [pythonPackages.selenium: FileNotFoundError: [Errno 2] No such file or directory, 'getAttribute.js' · Issue #181035 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/issues/181035)

I want to fix it locally in my shell.nix by overriding postInstall.

```nix
{ pkgs ? import <nixpkgs> { } }:

let

  python-with-my-packages = (let
    python = let
      packageOverrides = self: super: {
        selenium = super.selenium.overridePythonAttrs (old: rec {
          postInstall = ''
            install -Dm 755 ../rb/lib/selenium/webdriver/atoms/getAttribute.js $out/${self.sitePackages}/selenium/webdriver/remote/getAttribute.js
            install -Dm 755 ../rb/lib/selenium/webdriver/atoms/isDisplayed.js $out/${self.sitePackages}/selenium/webdriver/remote/isDisplayed.js
          '';

        });
      };
    in pkgs.python3.override {
      inherit packageOverrides;
      self = python;
    };

  in python.withPackages (ps: [ps.selenium])).passthru.pkgs.selenium;

in pkgs.mkShell {
  buildInputs = [
    python-with-my-packages

    pkgs.geckodriver

  ];

}

```

But is says, error: attribute ‘sitePackages’ missing. Where can I find this attribute, and how can learn how to find this attribute?

---

<div class="post-metadata">

### Author: ![ONdicabu](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/o/f1d935/32.png) [@ONdicabu](https://discourse.nixos.org/u/ONdicabu)
#### Post date: [January 25, 2023, 12:58pm UTC](https://discourse.nixos.org/t/how-to-fix-selenium-python-package-locally/23660/2 "2023-01-25T12:58:45Z")

</div>

Did it work for you finally?

---

<div class="post-metadata">

### Author: ![kvtb](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/k/ad7895/32.png) [@kvtb](https://discourse.nixos.org/u/kvtb)
#### Post date: [January 27, 2023, 9:23pm UTC](https://discourse.nixos.org/t/how-to-fix-selenium-python-package-locally/23660/3 "2023-01-27T21:23:11Z")

</div>

unfortunately not, here my Nix skills lack, so I pinned it to a 22.05 version of nixpkgs as workaround

---

<div class="post-metadata">

### Author: ![ONdicabu](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/o/f1d935/32.png) [@ONdicabu](https://discourse.nixos.org/u/ONdicabu)
#### Post date: [January 28, 2023, 10:43am UTC](https://discourse.nixos.org/t/how-to-fix-selenium-python-package-locally/23660/4 "2023-01-28T10:43:48Z")

</div>

For your information, this overlay finally worked for me:

```auto
with import <nixpkgs> {};

let
  python = let 
    packageOverrides = prev: final: {
      selenium = final.selenium.overridePythonAttrs (old: {
        src = fetchFromGitHub {
          owner = "SeleniumHQ";
          repo = "selenium";
          rev = "refs/tags/selenium-4.8.0";
          hash = "sha256-YTi6SNtTWuEPlQ3PTeis9osvtnWmZ7SRQbne9fefdco=";
        };
        postInstall = ''
          install -Dm 755 ../rb/lib/selenium/webdriver/atoms/getAttribute.js $out/${python3Packages.python.sitePackages}/selenium/webdriver/remote/getAttribute.js
          install -Dm 755 ../rb/lib/selenium/webdriver/atoms/isDisplayed.js $out/${python3Packages.python.sitePackages}/selenium/webdriver/remote/isDisplayed.js
        '';
      });
    }; in python3.override { inherit packageOverrides; };
in mkShell {
  packages = [
    (python.withPackages (
      ps: with ps; [
	pandas
	requests
	selenium
      ]))
  ];
}

```
