Update the docs
This commit is contained in:
parent
5d7f58665a
commit
3459aa98f3
|
@ -24,4 +24,4 @@ mkdocs-material==7.3.4;python_version>="3.6"
|
|||
mkdocs-exclude-search==0.5.2;python_version>="3.6"
|
||||
mkdocs-simple-hooks==0.1.3
|
||||
mkdocs-material-extensions==1.0.3;python_version>="3.6"
|
||||
mkdocs-minify-plugin==0.4.1
|
||||
mkdocs-minify-plugin==0.5.0
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
[<img src="https://seleniumbase.io/cdn/img/sb_logo_10t.png" title="SeleniumBase" width="240">](https://github.com/seleniumbase/SeleniumBase/)
|
||||
|
||||
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Logs, The Dashboard, and Reports:</h3>
|
||||
|
||||
<!-- YouTube View --><a href="https://www.youtube.com/watch?v=XpuJCjJhJwQ"><img src="http://img.youtube.com/vi/XpuJCjJhJwQ/0.jpg" title="SeleniumBase on YouTube" width="285" /></a>
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
<div><a href="https://seleniumbase.io/help_docs/webdriver_installation/"><b>Webdriver Installation</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/verify_webdriver/"><b>Verify Webdriver Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/"><b>Console Scripts Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/examples/example_logs/ReadMe/"><b>The Dashboard</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/recorder_mode/"><b>Recorder Mode</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/syntax_formats/"><b>Syntax Formats</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/mobile_testing/"><b>Mobile Device Testing</b></a></div>
|
||||
<div><a href="https://seleniumbase.io/help_docs/method_summary/"><b>Method Summary (API Ref)</b></a></div>
|
||||
|
@ -95,6 +97,8 @@
|
|||
<div><a href="https://seleniumbase.dev/help_docs/webdriver_installation"><b>Webdriver Installation</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/help_docs/verify_webdriver"><b>Verify Webdriver Works</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/seleniumbase/console_scripts/"><b>Console Scripts Tutorial</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/examples/example_logs/"><b>The Dashboard</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/help_docs/recorder_mode"><b>Recorder Mode</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/help_docs/syntax_formats"><b>Syntax Formats</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/help_docs/mobile_testing"><b>Mobile Device Testing</b></a></div>
|
||||
<div><a href="https://seleniumbase.dev/help_docs/method_summary"><b>Method Summary (API Ref)</b></a></div>
|
||||
|
|
|
@ -710,4 +710,4 @@ self._print(TEXT) # Calls Python's print() / Allows for translations
|
|||
* [test_tinymce.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_tinymce.py)
|
||||
* And many more...
|
||||
|
||||
[<img src="https://seleniumbase.io/cdn/img/sb_text_f.png" title="SeleniumBase" align="center" width="360">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
|
||||
[<img src="https://seleniumbase.io/cdn/img/sb_text_f.png" title="SeleniumBase" align="center" width="280">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
|
||||
|
|
|
@ -76,6 +76,8 @@ class RecorderTest(BaseCase):
|
|||
|
||||
<p>🔴 SeleniumBase <code>2.0.1</code> adds the ability to preview selectors via the page title when hovering over elements. It also fixes an issue that may occur when opening up new URLs while in Recorder Mode.</p>
|
||||
|
||||
<p>🔴 SeleniumBase <code>2.0.2</code> fixes a bug with Recorder Mode that was preventing the last recorded assert on a domain from being saved unless it was followed by a non-assert recorded action on the same domain.</p>
|
||||
|
||||
--------
|
||||
|
||||
<div>To learn more about SeleniumBase, check out the Docs Site:</div>
|
||||
|
|
|
@ -21,3 +21,89 @@ seleniumbase convert MY_TEST.py
|
|||
```
|
||||
|
||||
* You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.) This new clean & reliable SeleniumBase test script is ready to be added into your test suite for running.
|
||||
|
||||
--------
|
||||
|
||||
--------
|
||||
|
||||
The following is an example of a Katalon Recorder exported file (**WebDriver + unittest format**).
|
||||
It is **messy** and has **unnecessary lines of code** to do the task that was recorded:
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import NoAlertPresentException
|
||||
import unittest, time, re
|
||||
|
||||
class Swag(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.driver = webdriver.Firefox()
|
||||
self.driver.implicitly_wait(30)
|
||||
self.base_url = "https://www.google.com/"
|
||||
self.verificationErrors = []
|
||||
self.accept_next_alert = True
|
||||
|
||||
def test_swag(self):
|
||||
driver = self.driver
|
||||
driver.get("https://www.saucedemo.com/")
|
||||
driver.find_element_by_id("user-name").click()
|
||||
driver.find_element_by_id("user-name").clear()
|
||||
driver.find_element_by_id("user-name").send_keys("standard_user")
|
||||
driver.find_element_by_id("password").click()
|
||||
driver.find_element_by_id("password").clear()
|
||||
driver.find_element_by_id("password").send_keys("secret_sauce")
|
||||
driver.find_element_by_id("login-button").click()
|
||||
|
||||
def is_element_present(self, how, what):
|
||||
try: self.driver.find_element(by=how, value=what)
|
||||
except NoSuchElementException as e: return False
|
||||
return True
|
||||
|
||||
def is_alert_present(self):
|
||||
try: self.driver.switch_to_alert()
|
||||
except NoAlertPresentException as e: return False
|
||||
return True
|
||||
|
||||
def close_alert_and_get_its_text(self):
|
||||
try:
|
||||
alert = self.driver.switch_to_alert()
|
||||
alert_text = alert.text
|
||||
if self.accept_next_alert:
|
||||
alert.accept()
|
||||
else:
|
||||
alert.dismiss()
|
||||
return alert_text
|
||||
finally: self.accept_next_alert = True
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.quit()
|
||||
self.assertEqual([], self.verificationErrors)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
```
|
||||
|
||||
<div><b>This can be improved on...</b></div>
|
||||
|
||||
<b>After running <code>seleniumbase convert [FILE.py]</code> on it, here is the new result:</b>
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
|
||||
class Swag(BaseCase):
|
||||
|
||||
def test_swag(self):
|
||||
self.open('https://www.saucedemo.com/')
|
||||
self.type('#user-name', 'standard_user')
|
||||
self.type('#password', 'secret_sauce')
|
||||
self.click('#login-button')
|
||||
```
|
||||
|
||||
<b>This is much cleaner than the original version.
|
||||
It also uses the more reliable SeleniumBase methods.</b>
|
||||
|
|
|
@ -21,3 +21,89 @@ seleniumbase convert MY_TEST.py
|
|||
```
|
||||
|
||||
* You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.) This new clean & reliable SeleniumBase test script is ready to be added into your test suite for running.
|
||||
|
||||
--------
|
||||
|
||||
--------
|
||||
|
||||
The following is an example of a Katalon Recorder exported file (**WebDriver + unittest format**).
|
||||
It is **messy** and has **unnecessary lines of code** to do the task that was recorded:
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import NoAlertPresentException
|
||||
import unittest, time, re
|
||||
|
||||
class Swag(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.driver = webdriver.Firefox()
|
||||
self.driver.implicitly_wait(30)
|
||||
self.base_url = "https://www.google.com/"
|
||||
self.verificationErrors = []
|
||||
self.accept_next_alert = True
|
||||
|
||||
def test_swag(self):
|
||||
driver = self.driver
|
||||
driver.get("https://www.saucedemo.com/")
|
||||
driver.find_element_by_id("user-name").click()
|
||||
driver.find_element_by_id("user-name").clear()
|
||||
driver.find_element_by_id("user-name").send_keys("standard_user")
|
||||
driver.find_element_by_id("password").click()
|
||||
driver.find_element_by_id("password").clear()
|
||||
driver.find_element_by_id("password").send_keys("secret_sauce")
|
||||
driver.find_element_by_id("login-button").click()
|
||||
|
||||
def is_element_present(self, how, what):
|
||||
try: self.driver.find_element(by=how, value=what)
|
||||
except NoSuchElementException as e: return False
|
||||
return True
|
||||
|
||||
def is_alert_present(self):
|
||||
try: self.driver.switch_to_alert()
|
||||
except NoAlertPresentException as e: return False
|
||||
return True
|
||||
|
||||
def close_alert_and_get_its_text(self):
|
||||
try:
|
||||
alert = self.driver.switch_to_alert()
|
||||
alert_text = alert.text
|
||||
if self.accept_next_alert:
|
||||
alert.accept()
|
||||
else:
|
||||
alert.dismiss()
|
||||
return alert_text
|
||||
finally: self.accept_next_alert = True
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.quit()
|
||||
self.assertEqual([], self.verificationErrors)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
```
|
||||
|
||||
<div><b>This can be improved on...</b></div>
|
||||
|
||||
<b>After running <code>seleniumbase convert [FILE.py]</code> on it, here is the new result:</b>
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
|
||||
class Swag(BaseCase):
|
||||
|
||||
def test_swag(self):
|
||||
self.open('https://www.saucedemo.com/')
|
||||
self.type('#user-name', 'standard_user')
|
||||
self.type('#password', 'secret_sauce')
|
||||
self.click('#login-button')
|
||||
```
|
||||
|
||||
<b>This is much cleaner than the original version.
|
||||
It also uses the more reliable SeleniumBase methods.</b>
|
||||
|
|
|
@ -21,3 +21,89 @@ seleniumbase convert MY_TEST.py
|
|||
```
|
||||
|
||||
* You should see a [MY_TEST_SB.py] file appear in the folder. (``_SB`` is added to the file name so that the original file stays intact in case you still need it.) This new clean & reliable SeleniumBase test script is ready to be added into your test suite for running.
|
||||
|
||||
--------
|
||||
|
||||
--------
|
||||
|
||||
The following is an example of a Katalon Recorder exported file (**WebDriver + unittest format**).
|
||||
It is **messy** and has **unnecessary lines of code** to do the task that was recorded:
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import NoAlertPresentException
|
||||
import unittest, time, re
|
||||
|
||||
class Swag(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.driver = webdriver.Firefox()
|
||||
self.driver.implicitly_wait(30)
|
||||
self.base_url = "https://www.google.com/"
|
||||
self.verificationErrors = []
|
||||
self.accept_next_alert = True
|
||||
|
||||
def test_swag(self):
|
||||
driver = self.driver
|
||||
driver.get("https://www.saucedemo.com/")
|
||||
driver.find_element_by_id("user-name").click()
|
||||
driver.find_element_by_id("user-name").clear()
|
||||
driver.find_element_by_id("user-name").send_keys("standard_user")
|
||||
driver.find_element_by_id("password").click()
|
||||
driver.find_element_by_id("password").clear()
|
||||
driver.find_element_by_id("password").send_keys("secret_sauce")
|
||||
driver.find_element_by_id("login-button").click()
|
||||
|
||||
def is_element_present(self, how, what):
|
||||
try: self.driver.find_element(by=how, value=what)
|
||||
except NoSuchElementException as e: return False
|
||||
return True
|
||||
|
||||
def is_alert_present(self):
|
||||
try: self.driver.switch_to_alert()
|
||||
except NoAlertPresentException as e: return False
|
||||
return True
|
||||
|
||||
def close_alert_and_get_its_text(self):
|
||||
try:
|
||||
alert = self.driver.switch_to_alert()
|
||||
alert_text = alert.text
|
||||
if self.accept_next_alert:
|
||||
alert.accept()
|
||||
else:
|
||||
alert.dismiss()
|
||||
return alert_text
|
||||
finally: self.accept_next_alert = True
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.quit()
|
||||
self.assertEqual([], self.verificationErrors)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
```
|
||||
|
||||
<div><b>This can be improved on...</b></div>
|
||||
|
||||
<b>After running <code>seleniumbase convert [FILE.py]</code> on it, here is the new result:</b>
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
|
||||
class Swag(BaseCase):
|
||||
|
||||
def test_swag(self):
|
||||
self.open('https://www.saucedemo.com/')
|
||||
self.type('#user-name', 'standard_user')
|
||||
self.type('#password', 'secret_sauce')
|
||||
self.click('#login-button')
|
||||
```
|
||||
|
||||
<b>This is much cleaner than the original version.
|
||||
It also uses the more reliable SeleniumBase methods.</b>
|
||||
|
|
Loading…
Reference in New Issue