commit 4a1b080dda594ec4f16fbbf75755ce5a2bbf3932 Author: Lillian-Violet Date: Tue Mar 5 10:59:55 2024 +0100 init diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d1b0a3f --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "revCount": 591063, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.591063%2Brev-b8697e57f10292a6165a20f03d2f42920dfaf973/018e0b39-3c52-71b1-81e1-d90220875f22/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8709205 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "A Nix-flake-based Python development environment"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { + self, + nixpkgs, + }: let + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems (system: + f { + pkgs = import nixpkgs {inherit system;}; + }); + in { + devShells = forEachSupportedSystem ({pkgs}: { + default = pkgs.mkShell { + packages = with pkgs; + [python312 virtualenv geckodriver] + ++ (with pkgs.python312Packages; [pip selenium]); + }; + }); + }; +} diff --git a/main.py b/main.py new file mode 100644 index 0000000..d88ed11 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +from time import sleep +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys + +def gecko_test(): + # Set the driver + driver = webdriver.Firefox() + driver.get("https://duck.com") + elem = driver.find_element(By.NAME, "q") + elem.send_keys("seleniumhq" + Keys.RETURN) + sleep(5) + driver.quit() + +if __name__ == "__main__": + gecko_test()