Skip to content

Commit 1f59d72

Browse files
committed
Update console scripts
1 parent efcdf85 commit 1f59d72

File tree

5 files changed

+99
-20
lines changed

5 files changed

+99
-20
lines changed

seleniumbase/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from seleniumbase.fixtures.base_case import BaseCase # noqa
22
from seleniumbase.masterqa.master_qa import MasterQA # noqa
33
from seleniumbase.common import decorators # noqa
4+
from seleniumbase.common import encryption # noqa

seleniumbase/common/obfuscate.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ def main():
2323
print("*** ERROR: Passwords don't match! .. Please try again!")
2424
continue
2525
print("\nHere is the obfuscated password:")
26-
time.sleep(0.07)
27-
print(encryption.decrypt(password))
28-
time.sleep(0.21)
26+
time.sleep(0.2)
27+
encrypted_password = encryption.decrypt(password)
28+
print(encrypted_password)
29+
time.sleep(0.2)
30+
print("\nInside a test, use the following to decrypt it:\n")
31+
time.sleep(0.2)
32+
print(" from seleniumbase import encryption")
33+
print(" encryption.decrypt(%s)" % encrypted_password)
34+
time.sleep(0.2)
2935
except KeyboardInterrupt:
3036
print("\nExiting...\n")
3137

seleniumbase/console_scripts/run.py

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@
88
seleniumbase install chromedriver
99
seleniumbase mkdir browser_tests
1010
seleniumbase convert my_old_webdriver_unittest.py
11+
seleniumbase extract-objects my_first_test.py
12+
seleniumbase inject-objects my_first_test.py
13+
seleniumbase objectify my_first_test.py
14+
seleniumbase revert-objects my_first_test.py
15+
seleniumbase encrypt OR seleniumbase obfuscate
16+
seleniumbase decrypt OR seleniumbase unobfuscate
1117
seleniumbase download server
1218
seleniumbase grid-hub start
1319
seleniumbase grid-node start --hub=127.0.0.1
1420
"""
1521

1622
import sys
23+
from seleniumbase.common import obfuscate
24+
from seleniumbase.common import unobfuscate
1725
from seleniumbase.console_scripts import logo_helper
1826
from seleniumbase.console_scripts import sb_mkdir
1927
from seleniumbase.console_scripts import sb_install
@@ -44,6 +52,8 @@ def show_basic_usage():
4452
print(" inject-objects [SELENIUMBASE_PYTHON_FILE] [OPTIONS]")
4553
print(" objectify [SELENIUMBASE_PYTHON_FILE] [OPTIONS]")
4654
print(" revert-objects [SELENIUMBASE_PYTHON_FILE]")
55+
print(" encrypt OR obfuscate")
56+
print(" decrypt OR unobfuscate")
4757
print(" download server")
4858
print(" grid-hub [start|stop|restart] [OPTIONS]")
4959
print(" grid-node [start|stop|restart] --hub=[HUB_IP] [OPTIONS]")
@@ -171,6 +181,32 @@ def show_revert_objects_usage():
171181
print("")
172182

173183

184+
def show_encrypt_usage():
185+
print(" ** encrypt OR obfuscate **")
186+
print("")
187+
print(" Usage:")
188+
print(" seleniumbase encrypt")
189+
print(" OR")
190+
print(" seleniumbase obfuscate")
191+
print(" Output:")
192+
print(" Runs the password obfuscation tool.")
193+
print(" (Where you can enter a password to encrypt/obfuscate.)")
194+
print("")
195+
196+
197+
def show_decrypt_usage():
198+
print(" ** decrypt OR unobfuscate **")
199+
print("")
200+
print(" Usage:")
201+
print(" seleniumbase decrypt")
202+
print(" OR")
203+
print(" seleniumbase unobfuscate")
204+
print(" Output:")
205+
print(" Runs the password decryption/unobfuscation tool.")
206+
print(" (Where you can enter an encrypted password to decrypt.)")
207+
print("")
208+
209+
174210
def show_download_usage():
175211
print(" ** download **")
176212
print("")
@@ -189,7 +225,9 @@ def show_grid_hub_usage():
189225
print(" seleniumbase grid-hub {start|stop|restart}")
190226
print(" Options:")
191227
print(" -v, --verbose (Increase verbosity of logging output.)")
192-
print(" (Default: Quiet logging / not verbose.)")
228+
print(" (Default: Quiet logging / not verbose.)")
229+
print(" Example:")
230+
print(" seleniumbase grid-hub start")
193231
print(" Output:")
194232
print(" Controls the Selenium Grid Hub Server, which allows")
195233
print(" for running tests on multiple machines in parallel")
@@ -205,10 +243,12 @@ def show_grid_node_usage():
205243
print(" Usage:")
206244
print(" seleniumbase grid-node {start|stop|restart} [OPTIONS]")
207245
print(" Options:")
208-
print(" --hub=HUB_IP (The Grid Hub IP Address to connect to.)")
209-
print(" (Default: 127.0.0.1 if not set)")
246+
print(" --hub=[HUB_IP] (The Grid Hub IP Address to connect to.)")
247+
print(" (Default: 127.0.0.1 if not set)")
210248
print(" -v, --verbose (Increase verbosity of logging output.)")
211-
print(" (Default: Quiet logging / not verbose.)")
249+
print(" (Default: Quiet logging / not verbose.)")
250+
print(" Example:")
251+
print(" seleniumbase grid-node start --hub=127.0.0.1")
212252
print(" Output:")
213253
print(" Controls the Selenium Grid node, which serves as a")
214254
print(" worker machine for your Selenium Grid Hub server.")
@@ -253,6 +293,12 @@ def main():
253293
else:
254294
show_basic_usage()
255295
show_install_usage()
296+
elif command == "mkdir":
297+
if len(command_args) >= 1:
298+
sb_mkdir.main()
299+
else:
300+
show_basic_usage()
301+
show_mkdir_usage()
256302
elif command == "convert":
257303
if len(command_args) == 1:
258304
convert_ide.main()
@@ -283,12 +329,18 @@ def main():
283329
else:
284330
show_basic_usage()
285331
show_revert_objects_usage()
286-
elif command == "mkdir":
287-
if len(command_args) >= 1:
288-
sb_mkdir.main()
332+
elif command == "encrypt" or command == "obfuscate":
333+
if len(command_args) >= 0:
334+
obfuscate.main()
289335
else:
290336
show_basic_usage()
291-
show_mkdir_usage()
337+
show_encrypt_usage()
338+
elif command == "decrypt" or command == "unobfuscate":
339+
if len(command_args) >= 0:
340+
unobfuscate.main()
341+
else:
342+
show_basic_usage()
343+
show_decrypt_usage()
292344
elif command == "download":
293345
if len(command_args) >= 1 and command_args[0].lower() == "server":
294346
download_selenium_server.main(force_download=True)
@@ -337,6 +389,22 @@ def main():
337389
print("")
338390
show_revert_objects_usage()
339391
return
392+
elif command_args[0] == "encrypt":
393+
print("")
394+
show_encrypt_usage()
395+
return
396+
elif command_args[0] == "obfuscate":
397+
print("")
398+
show_encrypt_usage()
399+
return
400+
elif command_args[0] == "decrypt":
401+
print("")
402+
show_decrypt_usage()
403+
return
404+
elif command_args[0] == "unobfuscate":
405+
print("")
406+
show_decrypt_usage()
407+
return
340408
elif command_args[0] == "download":
341409
print("")
342410
show_download_usage()

seleniumbase/utilities/selenium_grid/grid_hub.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
def invalid_run_command():
88
exp = (" ** grid-hub **\n\n")
99
exp += " Usage:\n"
10-
exp += " seleniumbase grid-hub {start|stop|restart}\n"
10+
exp += " seleniumbase grid-hub {start|stop|restart}\n"
1111
exp += " Options:\n"
1212
exp += " -v, --verbose (Increase verbosity of logging output.)\n"
13-
exp += " (Default: Quiet logging / not verbose.)\n"
13+
exp += " (Default: Quiet logging / not verbose.)\n"
14+
exp += " Example:\n"
15+
exp += " seleniumbase grid-hub start\n"
1416
exp += " Output:\n"
15-
exp += " Controls the Selenium Grid Hub Server, which allows\n"
16-
exp += " for running tests on multiple machines in parallel\n"
17-
exp += " to speed up test runs and reduce the total time\n"
18-
exp += " of test suite execution.\n"
19-
exp += " You can start, restart, or stop the Grid Hub Server.\n"
17+
exp += " Controls the Selenium Grid Hub Server, which allows\n"
18+
exp += " for running tests on multiple machines in parallel\n"
19+
exp += " to speed up test runs and reduce the total time\n"
20+
exp += " of test suite execution.\n"
21+
exp += " You can start, restart, or stop the Grid Hub Server.\n"
2022
raise Exception('INVALID RUN COMMAND!\n\n%s' % exp)
2123

2224

seleniumbase/utilities/selenium_grid/grid_node.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ def invalid_run_command():
1010
exp += " seleniumbase grid-node {start|stop|restart} [OPTIONS]\n"
1111
exp += " Options:\n"
1212
exp += " --hub=[HUB_IP] (The Grid Hub IP Address to connect to.)\n"
13-
exp += " (Default: 127.0.0.1 if not set)\n"
13+
exp += " (Default: 127.0.0.1 if not set)\n"
1414
exp += " -v, --verbose (Increase verbosity of logging output.)\n"
15-
exp += " (Default: Quiet logging / not verbose.)\n"
15+
exp += " (Default: Quiet logging / not verbose.)\n"
16+
exp += " Example:\n"
17+
exp += " seleniumbase grid-node start --hub=127.0.0.1\n"
1618
exp += " Output:\n"
1719
exp += " Controls the Selenium Grid Node, which serves as a\n"
1820
exp += " worker machine for your Selenium Grid Hub Server.\n"

0 commit comments

Comments
 (0)