Update console scripts

This commit is contained in:
Michael Mintz 2024-02-11 20:55:58 -05:00
parent 715adb5ede
commit b3c93157ac
3 changed files with 47 additions and 1 deletions

View File

@ -37,6 +37,7 @@ COMMANDS:
revert-objects [SB_FILE.py] [OPTIONS]
encrypt / obfuscate
decrypt / unobfuscate
proxy (Start a basic proxy server)
download server (Get Selenium Grid JAR file)
grid-hub [start|stop] [OPTIONS]
grid-node [start|stop] --hub=[HOST/IP]
@ -653,6 +654,25 @@ Runs the password encryption/obfuscation tool.
Runs the password decryption/unobfuscation tool.
(Where you can enter an encrypted password to decrypt.)
<h3>proxy</h3>
* Usage:
```bash
sbase proxy [OPTIONS]
```
* Options:
``--hostname=HOSTNAME`` (Set ``hostname``) (Default: ``127.0.0.1``)
``--port=PORT`` (Set ``port``) (Default: ``8899``)
``--help`` / ``-h`` (Display list of all available ``proxy`` options.)
* Output:
Launch a basic proxy server on the current machine.
(Uses ``127.0.0.1:8899`` as the default address.)
<h3>download</h3>
* Usage:

View File

@ -32,6 +32,8 @@ sbase objectify my_first_test.py
sbase revert-objects my_first_test.py
sbase encrypt
sbase decrypt
sbase proxy
sbase proxy --hostname=127.0.0.1 --port=8899
sbase download server
sbase grid-hub start
sbase grid-node start --hub=127.0.0.1
@ -79,7 +81,7 @@ def show_basic_usage():
show_package_location()
show_version_info()
print("")
time.sleep(0.72) # Enough time to see the version
time.sleep(0.62) # Enough time to see the version
sc = ""
sc += ' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n'
sc += ' * OR: "sbase [COMMAND] [PARAMETERS]"\n'
@ -108,6 +110,7 @@ def show_basic_usage():
sc += " revert-objects [SB_FILE.py] [OPTIONS]\n"
sc += " encrypt / obfuscate\n"
sc += " decrypt / unobfuscate\n"
sc += " proxy (Start a basic proxy server)\n"
sc += " download server (Get Selenium Grid JAR file)\n"
sc += " grid-hub [start|stop] [OPTIONS]\n"
sc += " grid-node [start|stop] --hub=[HOST/IP]\n"
@ -1210,6 +1213,24 @@ def main():
show_options()
elif command == "behave-options" or command == "--behave-options":
show_behave_options()
elif command == "proxy" or command == "--proxy":
import fasteners
import os
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
pip_find_lock = fasteners.InterProcessLock(
constants.PipInstall.FINDLOCK
)
with pip_find_lock:
try:
from proxy import proxy # noqa: F401
except Exception:
shared_utils.pip_install(
"proxy.py", version=constants.ProxyPy.VER
)
os.system("proxy %s" % " ".join(sys.argv[2:]))
elif command == "help" or command == "--help":
if len(command_args) >= 1:
if command_args[0] == "get":

View File

@ -343,6 +343,11 @@ class Tether:
)
class ProxyPy:
# The version installed if proxy.py is not installed
VER = "2.4.3"
class SeleniumWire:
# The version installed if selenium-wire is not installed
VER = "5.1.0"