Skip to content

Commit ebff2f7

Browse files
committed
Update console scripts
1 parent c483c59 commit ebff2f7

File tree

6 files changed

+189
-110
lines changed

6 files changed

+189
-110
lines changed

seleniumbase/console_scripts/ReadMe.md

Lines changed: 92 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h2>🔮 Console Scripts 🔮</h2>
22

3-
⭐ SeleniumBase console scripts help you get things done, such as installing web drivers, creating a test directory with useful files, activating the SeleniumBase Recorder, launching the SeleniumBase Commander, translating tests into other languages, running a Selenium Grid, and more.
3+
⭐ SeleniumBase console scripts help you get things done, such as getting web drivers, creating a test directory with useful files, activating the SeleniumBase Recorder, launching the SeleniumBase Commander, translating tests into other languages, running a Selenium Grid, and more.
44

55
* Usage: ``seleniumbase [COMMAND] [PARAMETERS]``
66

@@ -12,10 +12,11 @@
1212

1313
```
1414
COMMANDS:
15-
install [DRIVER] [OPTIONS]
15+
get / install [DRIVER] [OPTIONS]
1616
methods (List common Python methods)
1717
options (List common pytest options)
18-
commander / gui [OPTIONAL PATH or TEST FILE]
18+
gui / commander [OPTIONAL PATH or TEST FILE]
19+
behave-gui (SBase Commander for Behave)
1920
mkdir [DIRECTORY] [OPTIONS]
2021
mkfile [FILE.py] [OPTIONS]
2122
mkrec / codegen [FILE.py] [OPTIONS]
@@ -35,31 +36,32 @@ COMMANDS:
3536
download server (Get Selenium Grid JAR file)
3637
grid-hub [start|stop] [OPTIONS]
3738
grid-node [start|stop] --hub=[HOST/IP]
38-
* (EXAMPLE: "sbase install chromedriver latest") *
39+
* (EXAMPLE: "sbase get chromedriver latest") *
3940
4041
Type "sbase help [COMMAND]" for specific command info.
4142
For info on all commands, type: "seleniumbase --help".
4243
Use "pytest" for running tests.
4344
```
4445

45-
<h3>install</h3>
46+
<h3>get / install</h3>
4647

4748
* Usage:
49+
``sbase get [DRIVER] [OPTIONS]``
4850
``sbase install [DRIVER] [OPTIONS]``
4951

5052
* Examples:
5153

5254
```bash
53-
sbase install chromedriver
54-
sbase install geckodriver
55-
sbase install edgedriver
56-
sbase install chromedriver 101
57-
sbase install chromedriver 101.0.4951.41
58-
sbase install chromedriver latest
59-
sbase install chromedriver latest-1 # (Latest minus one)
60-
sbase install chromedriver -p
61-
sbase install chromedriver latest -p
62-
sbase install edgedriver 101.0.1210.32
55+
sbase get chromedriver
56+
sbase get geckodriver
57+
sbase get edgedriver
58+
sbase get chromedriver 101
59+
sbase get chromedriver 101.0.4951.41
60+
sbase get chromedriver latest
61+
sbase get chromedriver latest-1 # (Latest minus one)
62+
sbase get chromedriver -p
63+
sbase get chromedriver latest -p
64+
sbase get edgedriver 101.0.1210.32
6365
```
6466

6567
(Drivers: ``chromedriver``, ``geckodriver``, ``edgedriver``,
@@ -72,11 +74,11 @@ sbase install edgedriver 101.0.1210.32
7274
``-p`` / ``--path``: Also copy to "/usr/local/bin".)
7375

7476
* Output:
75-
Installs the specified webdriver.
77+
Downloads the chosen webdriver to ``seleniumbase/drivers/``.
7678
(``chromedriver`` is required for Google Chrome automation)
7779
(``geckodriver`` is required for Mozilla Firefox automation)
7880
(``edgedriver`` is required for Microsoft Edge automation)
79-
(``iedriver`` is required for Internet Explorer automation)
81+
(``iedriver`` is required for InternetExplorer automation)
8082
(``operadriver`` is required for Opera Browser automation)
8183

8284
<h3>methods</h3>
@@ -96,23 +98,24 @@ Displays common SeleniumBase Python methods.
9698
Displays common pytest command-line options
9799
that are available when using SeleniumBase.
98100

99-
```
101+
```bash
100102
--browser=BROWSER (The web browser to use. Default is "chrome")
101103
--headless (Run tests headlessly. Default mode on Linux OS.)
102104
--demo (Slow down and visually see test actions as they occur.)
103105
--slow (Slow down the automation. Faster than using Demo Mode.)
104106
--reuse-session / --rs (Reuse browser session between tests.)
105107
--crumbs (Clear all cookies between tests reusing a session.)
106108
--maximize (Start tests with the web browser window maximized.)
107-
--dashboard (Enable SeleniumBase's Dashboard at dashboard.html)
108-
--incognito (Enable Chromium's Incognito mode.)
109-
--guest (Enable Chromium's Guest mode.)
109+
--dashboard (Enable SeleniumBase\'s Dashboard at dashboard.html)
110+
--incognito (Enable Chromium\'s Incognito mode.)
111+
--guest (Enable Chromium\'s Guest mode.)
110112
-m=MARKER (Run tests with the specified pytest marker.)
111113
-n=NUM (Multithread the tests using that many threads.)
112114
-v (Verbose mode. Print the full names of each test run.)
113115
--html=report.html (Create a detailed pytest-html report.)
114116
--collect-only / --co (Only show discovered tests. No run.)
115117
--co -q (Only show full names of discovered tests. No run.)
118+
-x (Stop running tests after the first failure is reached.)
116119
--pdb (Enter the Post Mortem Debug Mode after any test fails.)
117120
--trace (Enter Debug Mode immediately after starting any test.)
118121
| Debug Mode Commands >>> help / h: List all commands. |
@@ -122,12 +125,11 @@ that are available when using SeleniumBase.
122125
| longlist / ll: See code. dir(): List namespace objects. |
123126
--recorder (Record browser actions to generate test scripts.)
124127
--save-screenshot (Save a screenshot at the end of each test.)
125-
-x (Stop running the tests after the first failure is reached.)
126128
--archive-logs (Archive old log files instead of deleting them.)
127129
--check-js (Check for JavaScript errors after page loads.)
128130
--start-page=URL (The browser start page when tests begin.)
129-
--agent=STRING (Modify the web browser's User-Agent string.)
130-
--mobile (Use Chromium's mobile device emulator during tests.)
131+
--agent=STRING (Modify the web browser\'s User-Agent string.)
132+
--mobile (Use Chromium\'s mobile device emulator during tests.)
131133
--metrics=STRING (Set mobile "CSSWidth,CSSHeight,PixelRatio".)
132134
--ad-block (Block some types of display ads after page loads.)
133135
--settings-file=FILE (Override default SeleniumBase settings.)
@@ -142,27 +144,85 @@ that are available when using SeleniumBase.
142144
For the full list of command-line options, type: "pytest --help".
143145
```
144146
145-
<h3>commander / gui</h3>
147+
<h3>behave-options</h3>
148+
149+
* Usage:
150+
``sbase behave-options``
151+
152+
* Output:
153+
Displays common Behave command-line options
154+
that are available when using SeleniumBase.
155+
156+
```bash
157+
-D browser=BROWSER (The web browser to use. Default is "chrome")
158+
-D headless (Run tests headlessly. Default mode on Linux OS.)
159+
-D demo (Slow down and visually see test actions as they occur.)
160+
-D slow (Slow down the automation. Faster than using Demo Mode.)
161+
-D reuse-session / -D rs (Reuse browser session between tests.)
162+
-D crumbs (Clear all cookies between tests reusing a session.)
163+
-D maximize (Start tests with the web browser window maximized.)
164+
-D dashboard (Enable SeleniumBase\'s Dashboard at dashboard.html)
165+
-D incognito (Enable Chromium\'s Incognito mode.)
166+
-D guest (Enable Chromium\'s Guest mode.)
167+
--no-snippets / -q (Quiet mode. Don\'t print snippets.)
168+
--dry-run / -d (Dry run. Only show discovered tests.)
169+
--stop (Stop running tests after the first failure is reached.)
170+
-D pdb (Enter the Post Mortem Debug Mode after any test fails.)
171+
| Debug Mode Commands >>> help / h: List all commands. |
172+
| n: Next line of method. s: Step through. c: Continue. |
173+
| return / r: Run until method returns. j: Jump to line. |
174+
| where / w: Show stack spot. u: Up stack. d: Down stack. |
175+
| longlist / ll: See code. dir(): List namespace objects. |
176+
-D recorder (Record browser actions to generate test scripts.)
177+
-D save-screenshot (Save a screenshot at the end of each test.)
178+
-D archive-logs (Archive old log files instead of deleting them.)
179+
-D check-js (Check for JavaScript errors after page loads.)
180+
-D start-page=URL (The browser start page when tests begin.)
181+
-D agent=STRING (Modify the web browser\'s User-Agent string.)
182+
-D mobile (Use Chromium\'s mobile device emulator during tests.)
183+
-D metrics=STRING (Set mobile "CSSWidth,CSSHeight,PixelRatio".)
184+
-D ad-block (Block some types of display ads after page loads.)
185+
-D settings-file=FILE (Override default SeleniumBase settings.)
186+
-D env=ENV (Set the test env. Access with "self.env" in tests.)
187+
-D data=DATA (Extra test data. Access with "self.data" in tests.)
188+
-D disable-csp (Disable the Content Security Policy of websites.)
189+
-D server=SERVER (The Selenium Grid server/IP used for tests.)
190+
-D port=PORT (The Selenium Grid port used by the test server.)
191+
-D proxy=SERVER:PORT (Connect to a proxy server:port for tests.)
192+
-D proxy=USER:PASS@SERVER:PORT (Use authenticated proxy server.)
193+
194+
For the full list of command-line options, type: "behave --help".
195+
```
196+
197+
<h3>gui / commander</h3>
146198
147199
* Usage:
148200
149201
```bash
150-
sbase commander [OPTIONAL PATH or TEST FILE]
151202
sbase gui [OPTIONAL PATH or TEST FILE]
203+
sbase commander [OPTIONAL PATH or TEST FILE]
204+
```
205+
206+
<h3>behave-gui</h3>
207+
208+
* Usage:
209+
210+
```bash
211+
sbase behave-gui [OPTIONAL PATH or TEST FILE]
212+
sbase gui-behave [OPTIONAL PATH or TEST FILE]
152213
```
153214
154215
* Examples:
155216
156217
```bash
157-
sbase gui
158-
sbase gui -k agent
159-
sbase gui -m marker2
160-
sbase gui test_suite.py
161-
sbase gui offline_examples/
218+
sbase behave-gui
219+
sbase behave-gui -i=calculator
220+
sbase behave-gui features/
221+
sbase behave-gui features/calculator.feature
162222
```
163223
164224
* Output:
165-
Launches SeleniumBase Commander | GUI for pytest.
225+
Launches SeleniumBase Commander | GUI for Behave.
166226
167227
<h3>mkdir</h3>
168228

seleniumbase/console_scripts/objectify.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def invalid_run_command(shell_command):
3131

3232

3333
def invalid_objectify_run_command():
34-
exp = " ** objectify**\n\n"
34+
exp = " ** objectify **\n\n"
3535
exp += " Usage:\n"
3636
exp += " seleniumbase objectify [SELENIUMBASE_PYTHON_FILE]\n"
3737
exp += " Options:\n"
@@ -48,7 +48,7 @@ def invalid_objectify_run_command():
4848

4949

5050
def invalid_inject_objects_run_command():
51-
exp = " ** inject-objects**\n\n"
51+
exp = " ** inject-objects **\n\n"
5252
exp += " Usage:\n"
5353
exp += " seleniumbase inject-objects [SELENIUMBASE_PYTHON_FILE]\n"
5454
exp += " Options:\n"
@@ -62,7 +62,7 @@ def invalid_inject_objects_run_command():
6262

6363

6464
def invalid_extract_objects_run_command():
65-
exp = " ** extract-objects**\n\n"
65+
exp = " ** extract-objects **\n\n"
6666
exp += " Usage:\n"
6767
exp += " seleniumbase extract-objects [SELENIUMBASE_PYTHON_FILE]\n"
6868
exp += " Output:\n"
@@ -73,7 +73,7 @@ def invalid_extract_objects_run_command():
7373

7474

7575
def invalid_revert_objects_run_command():
76-
exp = " ** revert-objects**\n\n"
76+
exp = " ** revert-objects **\n\n"
7777
exp += " Usage:\n"
7878
exp += " seleniumbase revert-objects [SELENIUMBASE_PYTHON_FILE]\n"
7979
exp += " Options:\n"

seleniumbase/console_scripts/run.py

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
OR sbase [COMMAND] [PARAMETERS]
77
88
Examples:
9-
sbase install chromedriver
9+
sbase get chromedriver
1010
sbase methods
1111
sbase options
1212
sbase commander
13+
sbase behave-gui
1314
sbase mkdir ui_tests
1415
sbase mkfile new_test.py
1516
sbase mkrec new_test.py
@@ -76,10 +77,12 @@ def show_basic_usage():
7677
sc += ' * OR: "sbase [COMMAND] [PARAMETERS]"\n'
7778
sc += "\n"
7879
sc += "COMMANDS:\n"
79-
sc += " install [DRIVER] [OPTIONS]\n"
80+
sc += " get / install [DRIVER] [OPTIONS]\n"
8081
sc += " methods (List common Python methods)\n"
8182
sc += " options (List common pytest options)\n"
82-
sc += " commander / gui [OPTIONAL PATH or TEST FILE]\n"
83+
sc += " behave-options (List common Behave options)\n"
84+
sc += " gui / commander [OPTIONAL PATH or TEST FILE]\n"
85+
sc += " behave-gui (SBase Commander for Behave)\n"
8386
sc += " mkdir [DIRECTORY] [OPTIONS]\n"
8487
sc += " mkfile [FILE.py] [OPTIONS]\n"
8588
sc += " mkrec / codegen [FILE.py] [OPTIONS]\n"
@@ -99,7 +102,7 @@ def show_basic_usage():
99102
sc += " download server (Get Selenium Grid JAR file)\n"
100103
sc += " grid-hub [start|stop] [OPTIONS]\n"
101104
sc += " grid-node [start|stop] --hub=[HOST/IP]\n"
102-
sc += ' * (EXAMPLE: "sbase install chromedriver latest") *\n'
105+
sc += ' * (EXAMPLE: "sbase get chromedriver latest") *\n'
103106
sc += ""
104107
if "linux" not in sys.platform:
105108
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
@@ -114,32 +117,37 @@ def show_install_usage():
114117
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
115118
c3 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
116119
cr = colorama.Style.RESET_ALL
117-
sc = " " + c2 + "** " + c3 + "install" + c2 + " **" + cr
120+
sc = " " + c2 + "** " + c3 + "get / install" + c2 + " **" + cr
118121
print(sc)
119122
print("")
120123
print(" Usage:")
121124
print(" seleniumbase install [DRIVER_NAME] [OPTIONS]")
125+
print(" OR: seleniumbase get [DRIVER_NAME] [OPTIONS]")
122126
print(" OR: sbase install [DRIVER_NAME] [OPTIONS]")
127+
print(" OR: sbase get [DRIVER_NAME] [OPTIONS]")
123128
print(" (Drivers: chromedriver, geckodriver, edgedriver")
124129
print(" iedriver, operadriver)")
125130
print(" Options:")
126-
print(" VERSION Specify the version.")
127-
print(" (Default Chromedriver version = 2.44)")
128-
print(' Use "latest" for the latest version.')
131+
print(" VERSION Specify the version to download.")
132+
print(" (Default Chromedriver version = 2.44.")
133+
print(' Use "latest" for the latest version.')
134+
print(" For chromedriver, you can also use")
135+
print(" the major version integer")
136+
print(' or "latest-1" for 1 less than that.)')
129137
print(" -p OR --path Also copy the driver to /usr/local/bin")
130-
print(" Example:")
131-
print(" sbase install chromedriver")
132-
print(" sbase install geckodriver")
133-
print(" sbase install edgedriver")
134-
print(" sbase install chromedriver 101")
135-
print(" sbase install chromedriver 101.0.4951.41")
136-
print(" sbase install chromedriver latest")
137-
print(" sbase install chromedriver latest-1")
138-
print(" sbase install chromedriver -p")
139-
print(" sbase install chromedriver latest -p")
140-
print(" sbase install edgedriver 101.0.1210.32")
138+
print(" Examples:")
139+
print(" sbase get chromedriver")
140+
print(" sbase get geckodriver")
141+
print(" sbase get edgedriver")
142+
print(" sbase get chromedriver 101")
143+
print(" sbase get chromedriver 101.0.4951.41")
144+
print(" sbase get chromedriver latest")
145+
print(" sbase get chromedriver latest-1")
146+
print(" sbase get chromedriver -p")
147+
print(" sbase get chromedriver latest -p")
148+
print(" sbase get edgedriver 101.0.1210.32")
141149
print(" Output:")
142-
print(" Installs the chosen webdriver to seleniumbase/drivers/")
150+
print(" Downloads the chosen webdriver to seleniumbase/drivers")
143151
print(" (chromedriver is required for Chrome automation)")
144152
print(" (geckodriver is required for Firefox automation)")
145153
print(" (edgedriver is required for Microsoft Edge automation)")
@@ -748,6 +756,7 @@ def show_options():
748756
op += "--html=report.html (Create a detailed pytest-html report.)\n"
749757
op += "--collect-only / --co (Only show discovered tests. No run.)\n"
750758
op += "--co -q (Only show full names of discovered tests. No run.)\n"
759+
op += "-x (Stop running tests after the first failure is reached.)\n"
751760
op += "--pdb (Enter the Post Mortem Debug Mode after any test fails.)\n"
752761
op += "--trace (Enter Debug Mode immediately after starting any test.)\n"
753762
op += " | Debug Mode Commands >>> help / h: List all commands. |\n"
@@ -757,7 +766,6 @@ def show_options():
757766
op += " | longlist / ll: See code. dir(): List namespace objects. |\n"
758767
op += "--recorder (Record browser actions to generate test scripts.)\n"
759768
op += "--save-screenshot (Save a screenshot at the end of each test.)\n"
760-
op += "-x (Stop running the tests after the first failure is reached.)\n"
761769
op += "--archive-logs (Archive old log files instead of deleting them.)\n"
762770
op += "--check-js (Check for JavaScript errors after page loads.)\n"
763771
op += "--start-page=URL (The browser start page when tests begin.)\n"
@@ -903,7 +911,7 @@ def main():
903911
command_args = sys.argv[2:]
904912
command = command.lower()
905913

906-
if command == "install":
914+
if command == "get" or command == "install":
907915
if len(command_args) >= 1:
908916
from seleniumbase.console_scripts import sb_install
909917

seleniumbase/console_scripts/sb_commander.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def do_pytest_run(
158158
def create_tkinter_gui(tests, command_string):
159159
root = tk.Tk()
160160
root.title("SeleniumBase Commander | GUI for pytest")
161-
root.minsize(720, 640)
161+
root.minsize(820, 645)
162162
tk.Label(root, text="").pack()
163163

164164
options_list = [
@@ -179,7 +179,7 @@ def create_tkinter_gui(tests, command_string):
179179
"Reuse Session / clear cookies (--rs --crumbs)",
180180
]
181181
rsx = tk.StringVar(root)
182-
rsx.set(options_list[0])
182+
rsx.set(options_list[2])
183183
question_menu = tk.OptionMenu(root, rsx, *options_list)
184184
question_menu.pack()
185185

0 commit comments

Comments
 (0)