This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S pipx run | |
| # /// script | |
| # requires-python = ">=3.13" | |
| # dependencies = [ | |
| # "selenium==4.34.2", | |
| # ] | |
| # /// | |
| # This script has dependencies defined using inline script metadata (PEP 723) | |
| # Running it will create a temporary virtual environment, install depenendencies, then run the code (requires pipx) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # this is a total hack for `getopts` so it handles a single short or long option | |
| # - valid options are: -a, -h, --all, --help | |
| # - no args for options are allowed | |
| die () { | |
| tput setaf 1; echo -en "\u2717 "; tput sgr0 | |
| tput bold; echo "$*" 1>&2; tput sgr0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Problem: | |
| # When you call the black formatter, it prints all output to standand | |
| # error (even when no formatting is required). However, tox colors all | |
| # output to standard error in bold red. This results in black's | |
| # "All done! ... files left unchanged" message being colored red in | |
| # console output (which is very annoying). | |
| # | |
| # Workaround: | |
| # This is a `tox.ini` configuration file that invokes black through a | |
| # Python subprocess and redirects output to standard output when |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # example fixture for taking screenshots on test failures | |
| # | |
| # requires: | |
| # - pytest | |
| # - selenium | |
| import time | |
| import pytest | |
| from selenium import webdriver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REM - launch Git-Bash with symlinks enabled | |
| REM - (they are disabled for non-Admin accounts by default) | |
| set MSYS=winsymlinks:native | |
| %USERPROFILE%\Scoop\apps\git\current\git-bash.exe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # | |
| # Find all modules in a package without importing the package. | |
| # This will work for a package installed in `site-packages` or read from source. | |
| # | |
| # Requires Python 3.9+ | |
| import importlib.util | |
| import os | |
| import site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extract () { | |
| if [ -f $1 ] ; then | |
| case $1 in | |
| *.tar.bz2) tar xjf $1 ;; | |
| *.tar.gz) tar xzf $1 ;; | |
| *.bz2) bunzip2 $1 ;; | |
| *.rar) rar x $1 ;; | |
| *.gz) gunzip $1 ;; | |
| *.tar) tar xf $1 ;; | |
| *.tbz2) tar xjf $1 ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # This script downloads the latest stable version of the `selenium-manager` binary | |
| # for Linux (x86-64) from `https://github.com/SeleniumHQ/selenium_manager_artifacts/releases` | |
| # | |
| # When you run this script, it will download the binary to the current working directory. | |
| set -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # This script downloads the latest stable version of the `selenium-manager` binary | |
| # for Linux (x86-64) from `https://github.com/SeleniumHQ/selenium_manager_artifacts/releases` | |
| # | |
| # Before running this script, you should have the selenium repo cloned locally: | |
| # $ git clone --filter=blob:none [email protected]:SeleniumHQ/selenium.git | |
| # | |
| # Make sure to set the `SELENIUM_HOME` variable below to match the repo's base directory. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| # add one of these logging configurations to your selenium script to enable logging. | |
| # 6 logger levels are supported: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET. | |
| # (default is WARNING) | |
| # enable DEBUG logging to console for all modules globally (selenium, urllib3, etc) | |
| logging.basicConfig(level=logging.DEBUG) | |
| # enable DEBUG logging to console for selenium module |