1
1
[ <img src =" https://seleniumbase.io/cdn/img/sb_logo_10t.png " title =" SeleniumBase " width =" 240 " >] ( https://github.com/seleniumbase/SeleniumBase/ )
2
2
3
- ## Console Scripts
3
+ < h2 > Console Scripts</ h2 >
4
4
5
5
SeleniumBase console scripts help you get things done more easily, such as installing web drivers, creating a test directory with necessary configuration files, converting old WebDriver unittest scripts into SeleniumBase code, translating tests into multiple languages, and using the Selenium Grid.
6
6
@@ -12,7 +12,36 @@ SeleniumBase console scripts help you get things done more easily, such as insta
12
12
13
13
(<i >For running tests, [ use <b >pytest</b > with SeleniumBase] ( https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md ) .</i >)
14
14
15
- ### install
15
+ ```
16
+ COMMANDS:
17
+ install [DRIVER] [OPTIONS]
18
+ methods (List common Python methods)
19
+ options (List common pytest options)
20
+ mkdir [DIRECTORY] [OPTIONS]
21
+ mkfile [FILE.py] [OPTIONS]
22
+ mkrec [FILE.py]
23
+ mkpres [FILE.py] [LANG]
24
+ mkchart [FILE.py] [LANG]
25
+ print [FILE] [OPTIONS]
26
+ translate [SB_FILE.py] [LANG] [ACTION]
27
+ convert [WEBDRIVER_UNITTEST_FILE.py]
28
+ extract-objects [SB_FILE.py]
29
+ inject-objects [SB_FILE.py] [OPTIONS]
30
+ objectify [SB_FILE.py] [OPTIONS]
31
+ revert-objects [SB_FILE.py] [OPTIONS]
32
+ encrypt (OR: obfuscate)
33
+ decrypt (OR: unobfuscate)
34
+ download server (The Selenium Grid JAR file)
35
+ grid-hub [start|stop] [OPTIONS]
36
+ grid-node [start|stop] --hub=[HOST/IP]
37
+ * (EXAMPLE: "sbase install chromedriver latest") *
38
+
39
+ Type "sbase help [COMMAND]" for specific command info.
40
+ For info on all commands, type: "seleniumbase --help".
41
+ Use "pytest" for running tests.
42
+ ```
43
+
44
+ <h3 >install</h3 >
16
45
17
46
* Usage:
18
47
`` sbase install [DRIVER] [OPTIONS] ``
@@ -49,15 +78,15 @@ Installs the specified webdriver.
49
78
(`` iedriver `` is required for Internet Explorer automation)
50
79
(`` operadriver `` is required for Opera Browser automation)
51
80
52
- ### methods
81
+ < h3 > methods</ h3 >
53
82
54
83
* Usage:
55
84
`` sbase methods ``
56
85
57
86
* Output:
58
87
Displays common SeleniumBase Python methods.
59
88
60
- ### options
89
+ < h3 > options</ h3 >
61
90
62
91
* Usage:
63
92
`` sbase options ``
@@ -66,7 +95,53 @@ Displays common SeleniumBase Python methods.
66
95
Displays common pytest command-line options
67
96
that are available when using SeleniumBase.
68
97
69
- ### mkdir
98
+ ```
99
+ --browser=BROWSER (The web browser to use. Default is "chrome")
100
+ --headless (Run tests headlessly. Default mode on Linux OS.)
101
+ --demo (Slow down and visually see test actions as they occur.)
102
+ --slow (Slow down the automation. Faster than using Demo Mode.)
103
+ --reuse-session / --rs (Reuse browser session between tests.)
104
+ --crumbs (Clear all cookies between tests reusing a session.)
105
+ --maximize (Start tests with the web browser window maximized.)
106
+ --dashboard (Enable SeleniumBase's Dashboard at dashboard.html)
107
+ --incognito (Enable Chromium's Incognito mode.)
108
+ --guest (Enable Chromium's Guest mode.)
109
+ -m=MARKER (Run tests with the specified pytest marker.)
110
+ -n=NUM (Multithread the tests using that many threads.)
111
+ -v (Verbose mode. Print the full names of each test run.)
112
+ --html=report.html (Create a detailed pytest-html report.)
113
+ --collect-only / --co (Only show discovered tests. No run.)
114
+ --co -q (Only show full names of discovered tests. No run.)
115
+ --pdb (Enter the Post Mortem Debug Mode after any test fails.)
116
+ --trace (Enter Debug Mode immediately after starting any test.)
117
+ | Debug Mode Commands >>> help / h: List all commands. |
118
+ | n: Next line of method. s: Step through. c: Continue. |
119
+ | return / r: Run until method returns. j: Jump to line. |
120
+ | where / w: Show stack spot. u: Up stack. d: Down stack. |
121
+ | longlist / ll: See code. dir(): List namespace objects. |
122
+ --recorder (Record browser actions to generate test scripts.)
123
+ --save-screenshot (Save a screenshot at the end of each test.)
124
+ -x (Stop running the tests after the first failure is reached.)
125
+ --archive-logs (Archive old log files instead of deleting them.)
126
+ --check-js (Check for JavaScript errors after page loads.)
127
+ --start-page=URL (The browser start page when tests begin.)
128
+ --agent=STRING (Modify the web browser's User-Agent string.)
129
+ --mobile (Use Chromium's mobile device emulator during tests.)
130
+ --metrics=STRING (Set mobile "CSSWidth,CSSHeight,PixelRatio".)
131
+ --ad-block (Block some types of display ads after page loads.)
132
+ --settings-file=FILE (Override default SeleniumBase settings.)
133
+ --env=ENV (Set the test env. Access with "self.env" in tests.)
134
+ --data=DATA (Extra test data. Access with "self.data" in tests.)
135
+ --disable-csp (Disable the Content Security Policy of websites.)
136
+ --server=SERVER (The Selenium Grid server/IP used for tests.)
137
+ --port=PORT (The Selenium Grid port used by the test server.)
138
+ --proxy=SERVER:PORT (Connect to a proxy server:port for tests.)
139
+ --proxy=USER:PASS@SERVER:PORT (Use authenticated proxy server.)
140
+
141
+ For the full list of command-line options, type: "pytest --help".
142
+ ```
143
+
144
+ <h3 >mkdir</h3 >
70
145
71
146
* Usage:
72
147
`` sbase mkdir [DIRECTORY] [OPTIONS] ``
@@ -118,7 +193,7 @@ ui_tests/
118
193
└── setup.cfg
119
194
```
120
195
121
- ### mkfile
196
+ < h3 > mkfile</ h3 >
122
197
123
198
* Usage:
124
199
`` sbase mkfile [FILE.py] [OPTIONS] ``
@@ -147,7 +222,19 @@ methods, which are "open", "type", "click",
147
222
basic boilerplate option, only the "open" method
148
223
is included.
149
224
150
- ### mkpres
225
+ <h3 >mkrec</h3 >
226
+
227
+ * Usage:
228
+ `` sbase mkrec [FILE.py] ``
229
+
230
+ * Example:
231
+ `` sbase mkrec new_test.py ``
232
+
233
+ * Output:
234
+ Creates a new SeleniumBase test using the Recorder.
235
+ If the filename already exists, an error is raised.
236
+
237
+ <h3 >mkpres</h3 >
151
238
152
239
* Usage:
153
240
`` sbase mkpres [FILE.py] [LANG] ``
@@ -169,7 +256,7 @@ By default, the slides are written in English,
169
256
and use "serif" theme with "slide" transition.
170
257
The slides can be used as a basic boilerplate.
171
258
172
- ### mkchart
259
+ < h3 > mkchart</ h3 >
173
260
174
261
* Usage:
175
262
`` sbase mkchart [FILE.py] [LANG] ``
@@ -191,7 +278,7 @@ By default, the slides are written in English,
191
278
and use a "sky" theme with "slide" transition.
192
279
The chart can be used as a basic boilerplate.
193
280
194
- ### print
281
+ < h3 > print</ h3 >
195
282
196
283
* Usage:
197
284
`` sbase print [FILE] [OPTIONS] ``
@@ -203,7 +290,7 @@ The chart can be used as a basic boilerplate.
203
290
Prints the code/text of any file
204
291
with syntax-highlighting.
205
292
206
- ### translate
293
+ < h3 > translate</ h3 >
207
294
208
295
* Usage:
209
296
`` sbase translate [SB_FILE.py] [LANGUAGE] [ACTION] ``
@@ -234,7 +321,7 @@ plus the 2-letter language code of the new language.
234
321
(Example: Translating "test_1.py" into Japanese with
235
322
`` -c `` will create a new file called "test_1_ja.py".)
236
323
237
- ### extract-objects
324
+ < h3 > extract-objects</ h3 >
238
325
239
326
* Usage:
240
327
`` sbase extract-objects [SB_FILE.py] ``
@@ -244,7 +331,7 @@ Creates page objects based on selectors found in a
244
331
seleniumbase Python file and saves those objects to the
245
332
"page_objects.py" file in the same folder as the tests.
246
333
247
- ### inject-objects
334
+ < h3 > inject-objects</ h3 >
248
335
249
336
* Usage:
250
337
`` sbase inject-objects [SB_FILE.py] [OPTIONS] ``
@@ -257,7 +344,7 @@ Takes the page objects found in the "page_objects.py"
257
344
file and uses those to replace matching selectors in
258
345
the selected seleniumbase Python file.
259
346
260
- ### objectify
347
+ < h3 > objectify</ h3 >
261
348
262
349
* Usage:
263
350
`` sbase objectify [SB_FILE.py] [OPTIONS] ``
@@ -272,7 +359,7 @@ have been replaced with variable names defined in
272
359
(This has the same outcome as combining
273
360
`` extract-objects `` with `` inject-objects `` )
274
361
275
- ### revert-objects
362
+ < h3 > revert-objects</ h3 >
276
363
277
364
* Usage:
278
365
`` sbase revert-objects [SB_FILE.py] [OPTIONS] ``
@@ -286,7 +373,7 @@ Reverts the changes made by ``seleniumbase objectify ...`` or
286
373
seleniumbase Python file. Objects will get replaced by
287
374
selectors stored in the "page_objects.py" file.
288
375
289
- ### convert
376
+ < h3 > convert</ h3 >
290
377
291
378
* Usage:
292
379
`` sbase convert [WEBDRIVER_UNITTEST_FILE.py] ``
@@ -298,7 +385,7 @@ file name while keeping the original file intact.
298
385
Works with Katalon Recorder scripts.
299
386
See [ This ReadMe] ( https://seleniumbase.io/seleniumbase/utilities/selenium_ide/ReadMe/ ) for details.
300
387
301
- ### encrypt / obfuscate
388
+ < h3 > encrypt / obfuscate</ h3 >
302
389
303
390
* Usage:
304
391
`` sbase encrypt `` OR `` sbase obfuscate ``
@@ -307,7 +394,7 @@ See [This ReadMe](https://seleniumbase.io/seleniumbase/utilities/selenium_ide/Re
307
394
Runs the password encryption/obfuscation tool.
308
395
(Where you can enter a password to encrypt/obfuscate.)
309
396
310
- ### decrypt / unobfuscate
397
+ < h3 > decrypt / unobfuscate</ h3 >
311
398
312
399
* Usage:
313
400
`` sbase decrypt `` OR `` sbase unobfuscate ``
@@ -316,7 +403,7 @@ Runs the password encryption/obfuscation tool.
316
403
Runs the password decryption/unobfuscation tool.
317
404
(Where you can enter an encrypted password to decrypt.)
318
405
319
- ### download
406
+ < h3 > download</ h3 >
320
407
321
408
* Usage:
322
409
`` sbase download server ``
@@ -325,7 +412,7 @@ Runs the password decryption/unobfuscation tool.
325
412
Downloads the Selenium Server JAR file for Grid usage.
326
413
(That JAR file is required when using a Selenium Grid)
327
414
328
- ### grid-hub
415
+ < h3 > grid-hub</ h3 >
329
416
330
417
* Usage:
331
418
`` sbase grid-hub {start|stop|restart} [OPTIONS] ``
@@ -341,7 +428,7 @@ to speed up test runs and reduce the total time
341
428
of test suite execution.
342
429
You can start, restart, or stop the Grid Hub server.
343
430
344
- ### grid-node
431
+ < h3 > grid-node</ h3 >
345
432
346
433
* Usage:
347
434
`` sbase grid-node {start|stop|restart} [OPTIONS] ``
0 commit comments