Skip to content

Commit b3c9315

Browse files
committed
Update console scripts
1 parent 715adb5 commit b3c9315

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

seleniumbase/console_scripts/ReadMe.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ COMMANDS:
3737
revert-objects [SB_FILE.py] [OPTIONS]
3838
encrypt / obfuscate
3939
decrypt / unobfuscate
40+
proxy (Start a basic proxy server)
4041
download server (Get Selenium Grid JAR file)
4142
grid-hub [start|stop] [OPTIONS]
4243
grid-node [start|stop] --hub=[HOST/IP]
@@ -653,6 +654,25 @@ Runs the password encryption/obfuscation tool.
653654
Runs the password decryption/unobfuscation tool.
654655
(Where you can enter an encrypted password to decrypt.)
655656
657+
<h3>proxy</h3>
658+
659+
* Usage:
660+
661+
```bash
662+
sbase proxy [OPTIONS]
663+
```
664+
665+
* Options:
666+
667+
``--hostname=HOSTNAME`` (Set ``hostname``) (Default: ``127.0.0.1``)
668+
``--port=PORT`` (Set ``port``) (Default: ``8899``)
669+
``--help`` / ``-h`` (Display list of all available ``proxy`` options.)
670+
671+
* Output:
672+
673+
Launch a basic proxy server on the current machine.
674+
(Uses ``127.0.0.1:8899`` as the default address.)
675+
656676
<h3>download</h3>
657677
658678
* Usage:

seleniumbase/console_scripts/run.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
sbase revert-objects my_first_test.py
3333
sbase encrypt
3434
sbase decrypt
35+
sbase proxy
36+
sbase proxy --hostname=127.0.0.1 --port=8899
3537
sbase download server
3638
sbase grid-hub start
3739
sbase grid-node start --hub=127.0.0.1
@@ -79,7 +81,7 @@ def show_basic_usage():
7981
show_package_location()
8082
show_version_info()
8183
print("")
82-
time.sleep(0.72) # Enough time to see the version
84+
time.sleep(0.62) # Enough time to see the version
8385
sc = ""
8486
sc += ' * USAGE: "seleniumbase [COMMAND] [PARAMETERS]"\n'
8587
sc += ' * OR: "sbase [COMMAND] [PARAMETERS]"\n'
@@ -108,6 +110,7 @@ def show_basic_usage():
108110
sc += " revert-objects [SB_FILE.py] [OPTIONS]\n"
109111
sc += " encrypt / obfuscate\n"
110112
sc += " decrypt / unobfuscate\n"
113+
sc += " proxy (Start a basic proxy server)\n"
111114
sc += " download server (Get Selenium Grid JAR file)\n"
112115
sc += " grid-hub [start|stop] [OPTIONS]\n"
113116
sc += " grid-node [start|stop] --hub=[HOST/IP]\n"
@@ -1210,6 +1213,24 @@ def main():
12101213
show_options()
12111214
elif command == "behave-options" or command == "--behave-options":
12121215
show_behave_options()
1216+
elif command == "proxy" or command == "--proxy":
1217+
import fasteners
1218+
import os
1219+
import warnings
1220+
1221+
with warnings.catch_warnings():
1222+
warnings.simplefilter("ignore", category=UserWarning)
1223+
pip_find_lock = fasteners.InterProcessLock(
1224+
constants.PipInstall.FINDLOCK
1225+
)
1226+
with pip_find_lock:
1227+
try:
1228+
from proxy import proxy # noqa: F401
1229+
except Exception:
1230+
shared_utils.pip_install(
1231+
"proxy.py", version=constants.ProxyPy.VER
1232+
)
1233+
os.system("proxy %s" % " ".join(sys.argv[2:]))
12131234
elif command == "help" or command == "--help":
12141235
if len(command_args) >= 1:
12151236
if command_args[0] == "get":

seleniumbase/fixtures/constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ class Tether:
343343
)
344344

345345

346+
class ProxyPy:
347+
# The version installed if proxy.py is not installed
348+
VER = "2.4.3"
349+
350+
346351
class SeleniumWire:
347352
# The version installed if selenium-wire is not installed
348353
VER = "5.1.0"

0 commit comments

Comments
 (0)