You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-11Lines changed: 17 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -134,31 +134,37 @@ class CoffeeCartTest(BaseCase):
134
134
<summary> ▶️ How is <b>SeleniumBase</b> different from raw Selenium? (<b>click to expand</b>)</summary>
135
135
<div>
136
136
137
-
<p>💡 SeleniumBase is a Python framework for browser automation and testing. SeleniumBase uses <ahref="https://www.w3.org/TR/webdriver2/#endpoints"target="_blank">Selenium/WebDriver</a> APIs, and incorporates test-runners such as <codetranslate="no">pytest</code>, <codetranslate="no">pynose</code>, and <codetranslate="no">behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>such as choosing the browser to use</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p>
137
+
<p>💡 SeleniumBase is a Python framework for browser automation and testing. SeleniumBase uses <ahref="https://www.w3.org/TR/webdriver2/#endpoints"target="_blank">Selenium/WebDriver</a> APIs and incorporates test-runners such as <codetranslate="no">pytest</code>, <codetranslate="no">pynose</code>, and <codetranslate="no">behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>eg. browser selection</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p>
138
138
139
-
<p>💡 With raw Selenium, commands that use selectors need to specify the type of selector (eg. <codetranslate="no">"css selector", "button#myButton"</code>). With SeleniumBase, there's auto-detection between CSS Selectors and XPath, which means you don't need to specify the type of selector in your commands (<i>but optionally you could</i>).</p>
139
+
<p>💡 SeleniumBase's driver manager gives you more control over automatic driver downloads. (Use <codetranslate="no">--driver-version=VER</code> with your <codetranslate="no">pytest</code> run command to specify the version.) By default, SeleniumBase will download a driver version that matches your major browser version if not set.</p>
140
140
141
-
<p>💡 SeleniumBase methods often perform multiple actions in a single method call. For example, <codetranslate="no">self.type(selector,text)</code> does the following:<br />1. Waits for the element to be visible.<br />2. Waits for the element to be interactive.<br />3. Clears the text field.<br />4. Types in the new text.<br />5. Presses Enter/Submit if the text ends in <codetranslate="no">"\n"</code>.<br />With raw Selenium, those actions require multiple method calls.</p>
141
+
<p>💡 SeleniumBase automatically detects between CSS Selectors and XPath, which means you don't need to specify the type of selector in your commands (<i>but optionally you could</i>).</p>
142
+
143
+
<p>💡 SeleniumBase methods often perform multiple actions in a single method call. For example, <codetranslate="no">self.type(selector, text)</code> does the following:<br />1. Waits for the element to be visible.<br />2. Waits for the element to be interactive.<br />3. Clears the text field.<br />4. Types in the new text.<br />5. Presses Enter/Submit if the text ends in <codetranslate="no">"\n"</code>.<br />With raw Selenium, those actions require multiple method calls.</p>
142
144
143
145
<p>💡 SeleniumBase uses default timeout values when not set:<br />
<p>💡 SeleniumBase gives you clean error output when a test fails. With raw Selenium, error messages can get very messy.</p>
156
158
157
-
<p>💡 SeleniumBase gives you the option to generate a dashboard and reports for tests. It also saves screenshots from failing tests to the <codetranslate="no">./latest_logs/</code> folder. Raw <ahref="https://www.selenium.dev/documentation/webdriver/"target="_blank">Selenium</a> does not have these options out-of-the-box.</p>
159
+
<p>💡 SeleniumBase gives you the option to generate a dashboard and reports for tests. It also saves screenshots from failing tests to the <codetranslate="no">./latest_logs/</code> folder. Raw <ahref="https://www.selenium.dev/documentation/webdriver/"translate="no"target="_blank">Selenium</a> does not have these options out-of-the-box.</p>
160
+
161
+
<p>💡 SeleniumBase includes desktop GUI apps for running tests, such as <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/commander.md"translate="no">SeleniumBase Commander</a> for <codetranslate="no">pytest</code> and <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md"translate="no">SeleniumBase Behave GUI</a> for <codetranslate="no">behave</code>.</p>
162
+
163
+
<p>💡 SeleniumBase has its own <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md">Recorder / Test Generator</a> for creating tests from manual browser actions.</p>
158
164
159
-
<p>💡 SeleniumBase includes desktop GUI apps for running tests, such as <btranslate="no">SeleniumBase Commander</b> for <codetranslate="no">pytest</code> and <b><spantranslate="no">SeleniumBase Behave GUI</span> for <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md"><codetranslate="no">behave</code></a>.</b></p>
165
+
<p>💡 SeleniumBase comes with <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">test case management software, ("CasePlans")</a>, for organizing tests and step descriptions.</p>
160
166
161
-
<p>💡 SeleniumBase has its own Recorder / Test Generator that can create tests from manual browser actions. SeleniumBase also includes other useful tools and console scripts for getting things done quickly. (<i>See the documentation for more details!</i>)</p>
167
+
<p>💡 SeleniumBase includes tools for <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md">building data apps, ("ChartMaker")</a>, which can generate JavaScript from Python.</p>
Copy file name to clipboardExpand all lines: examples/migration/raw_selenium/ReadMe.md
+23-9Lines changed: 23 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -41,25 +41,39 @@ With a complete test automation framework built, most of the hard work is alread
41
41
### 🔵 How is SeleniumBase different from raw Selenium?
42
42
43
43
<div>
44
-
<p>💡 SeleniumBase is a Python test framework for the <ahref="https://www.w3.org/TR/webdriver2/#endpoints"target="_blank">Selenium/WebDriver</a> browser automation library. This framework incorporates test-runners such as <code>pytest</code>, <code>nosetests</code>, and <code>behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>such as choosing the browser to use</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p>
45
44
46
-
<p>💡 With raw Selenium, you have to manually download drivers (<i>eg. chromedriver</i>) before running tests. With SeleniumBase's driver manager, that's done automatically for you if the required driver isn't already on your PATH. There are also console scripts available for more control (eg. <code>sbase get chromedriver latest</code> to download the latest version of chromedriver to a local SeleniumBase directory).</p>
45
+
<p>💡 SeleniumBase is a Python framework for browser automation and testing. SeleniumBase uses <ahref="https://www.w3.org/TR/webdriver2/#endpoints"target="_blank">Selenium/WebDriver</a> APIs and incorporates test-runners such as <codetranslate="no">pytest</code>, <codetranslate="no">pynose</code>, and <codetranslate="no">behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>eg. browser selection</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p>
47
46
48
-
<p>💡 With raw Selenium, commands that use selectors need to specify the type of selector (eg. <code>"css selector", "button#myButton"</code>). With SeleniumBase, there's auto-detection between CSS Selectors and XPath, which means you don't need to specify the type of selector in your commands (<i>but optionally you could</i>).</p>
47
+
<p>💡 SeleniumBase's driver manager gives you more control over automatic driver downloads. (Use <codetranslate="no">--driver-version=VER</code> with your <codetranslate="no">pytest</code> run command to specify the version.) By default, SeleniumBase will download a driver version that matches your major browser version if not set.</p>
49
48
50
-
<p>💡 SeleniumBase methods often perform multiple actions in a single method call. For example, <code>self.type(selector,text)</code> does the following:<br />1. Waits for the element to be visible.<br />2. Waits for the element to be interactive.<br />3. Clears the text field.<br />4. Types in the new text.<br />5. Presses Enter/Submit if the text ends in <code>"\n"</code>.<br />With raw Selenium, those actions require multiple method calls.</p>
49
+
<p>💡 SeleniumBase automatically detects between CSS Selectors and XPath, which means you don't need to specify the type of selector in your commands (<i>but optionally you could</i>).</p>
51
50
52
-
<p>💡 SeleniumBase uses default timeout values when not set, which means that methods automatically wait for elements to appear (<i>up to the timeout limit</i>) before failing:<br />✅<code>self.click("button")</code><br />With raw Selenium, methods would fail instantly (<i>by default</i>) if an element needed more time to load:<br />❌<code>self.driver.find_element(by="css selector", value="button").click()</code><br />(Reliable code is better than unreliable code.)</p>
51
+
<p>💡 SeleniumBase methods often perform multiple actions in a single method call. For example, <codetranslate="no">self.type(selector, text)</code> does the following:<br />1. Waits for the element to be visible.<br />2. Waits for the element to be interactive.<br />3. Clears the text field.<br />4. Types in the new text.<br />5. Presses Enter/Submit if the text ends in <codetranslate="no">"\n"</code>.<br />With raw Selenium, those actions require multiple method calls.</p>
53
52
54
-
<p>💡 SeleniumBase lets you change the explicit timeout values of methods:<br />✅<code>self.click("button",timeout=10)</code><br />With raw Selenium, that requires more code:<br />❌<code>WebDriverWait(driver,10).until(EC.element_to_be_clickable("css selector", "button")).click()</code><br />(Simple code is better than complex code.)</p>
53
+
<p>💡 SeleniumBase uses default timeout values when not set:<br />
<p>💡 SeleniumBase gives you clean error output when a test fails. With raw Selenium, error messages can get very messy.</p>
57
66
58
-
<p>💡 SeleniumBase gives you the option to generate a dashboard and reports for tests. It also saves screenshots from failing tests to the <code>./latest_logs/</code> folder. Raw Selenium does not have these options out-of-the-box.</p>
67
+
<p>💡 SeleniumBase gives you the option to generate a dashboard and reports for tests. It also saves screenshots from failing tests to the <codetranslate="no">./latest_logs/</code> folder. Raw <ahref="https://www.selenium.dev/documentation/webdriver/"translate="no"target="_blank">Selenium</a> does not have these options out-of-the-box.</p>
68
+
69
+
<p>💡 SeleniumBase includes desktop GUI apps for running tests, such as <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/commander.md"translate="no">SeleniumBase Commander</a> for <codetranslate="no">pytest</code> and <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md"translate="no">SeleniumBase Behave GUI</a> for <codetranslate="no">behave</code>.</p>
70
+
71
+
<p>💡 SeleniumBase has its own <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md">Recorder / Test Generator</a> for creating tests from manual browser actions.</p>
72
+
73
+
<p>💡 SeleniumBase comes with <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/case_plans.md">test case management software, ("CasePlans")</a>, for organizing tests and step descriptions.</p>
59
74
60
-
<p>💡 SeleniumBase includes desktop GUI apps for running tests, such as <b>SeleniumBase Commander</b> for <code>pytest</code>, and <b>SeleniumBase Behave GUI.</b></p>
75
+
<p>💡 SeleniumBase includes tools for <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/ReadMe.md">building data apps, ("ChartMaker")</a>, which can generate JavaScript from Python.</p>
61
76
62
-
<p>💡 SeleniumBase has its own Recorder & Test Generator that can create tests from manual browser actions. SeleniumBase also has many other useful tools and console scripts for getting things done quickly. (<i>See the documentation for more details!</i>)</p>
<h3><imgsrc="https://seleniumbase.github.io/img/green_logo.png"title="SeleniumBase"width="32" /> Changing the default driver version:</h3>
415
+
416
+
🔵 By default, SeleniumBase will make sure that the major driver version matches the major browser version for Chromium tests. (Eg. If Chrome `117.X` is installed and you have chromedriver `117.X`, then nothing happens, but if you had chromedriver `116.X` instead, then SeleniumBase would download chromedriver `117.X` to match the browser version.)
417
+
418
+
🎛️ To change this default behavior, you can use:
419
+
420
+
```bash
421
+
pytest --driver-version=VER
422
+
```
423
+
424
+
The `VER` in `--driver-version=VER` can be:
425
+
* A major driver version. Eg. `117`. (milestone)
426
+
* An exact driver version. Eg. `117.0.5938.92`.
427
+
*``"browser"`` (exact match on browser version)
428
+
*``"keep"`` (keep using the driver you already have)
*``"previous"`` / ``"latest-1"`` (latest minus one)
431
+
*``"beta"`` (latest beta version)
432
+
*``"dev"`` (latest dev version)
433
+
*``"canary"`` (latest canary version)
434
+
*``"mlatest"`` (latest version for the milestone)
435
+
436
+
Note that different options could lead to the same result. (Eg. If you have the latest version of a browser for a milestone, then ``"browser"`` and ``"mlatest"`` should give you the same driver if the latest driver version for that milestone matches the browser version.)
🎛️ An easy way to override [seleniumbase/config/settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) is by using a custom settings file.
0 commit comments