summaryrefslogtreecommitdiff
path: root/.local/bin/development/ipytest
diff options
context:
space:
mode:
authorVikas Kushwaha <dev@vikas.rocks>2024-11-21 13:30:52 +0530
committerVikas Kushwaha <dev@vikas.rocks>2024-11-21 13:30:52 +0530
commit5c916d69d457101326803eb076a746060e3618cf (patch)
treed6fce3256eede1c1bf78fb6a1be75b9cc4b84cee /.local/bin/development/ipytest
Moved from github
Diffstat (limited to '.local/bin/development/ipytest')
-rwxr-xr-x.local/bin/development/ipytest23
1 files changed, 23 insertions, 0 deletions
diff --git a/.local/bin/development/ipytest b/.local/bin/development/ipytest
new file mode 100755
index 0000000..17a5a55
--- /dev/null
+++ b/.local/bin/development/ipytest
@@ -0,0 +1,23 @@
+#!/bin/sh
+# create a 'dev' firefox profile and use it in selenium
+
+[ -z "$FF_DEV_PROFILE" ] && [ -d ~/.librewolf ] &&
+ FF_DEV_PROFILE="$(find ~/.librewolf/ -maxdepth 1 -type d -name '????????.dev')"
+
+[ -z "$FF_DEV_PROFILE" ] && [ -d ~/.librewolf ] &&
+ FF_DEV_PROFILE="$(find ~/.mozilla/ -maxdepth 1 -type d -name '????????.dev')"
+
+ipy -i -c "
+from selenium import webdriver
+from selenium.webdriver.common.by import By
+
+options = webdriver.FirefoxOptions()
+options.binary_location = '/usr/bin/librewolf'
+options.profile = webdriver.FirefoxProfile(\"$FF_DEV_PROFILE\")
+
+d = webdriver.Firefox(options=options)
+d.get(\"${1:-http://127.0.0.1}\")
+
+import atexit
+atexit.register(d.quit)
+"