diff --git a/docs/requirements.txt b/docs/requirements.txt index 2621131c..108bbe40 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -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 diff --git a/examples/example_logs/ReadMe.md b/examples/example_logs/ReadMe.md index 2e0035b3..00067ddf 100755 --- a/examples/example_logs/ReadMe.md +++ b/examples/example_logs/ReadMe.md @@ -1,3 +1,5 @@ +[](https://github.com/seleniumbase/SeleniumBase/) +

Logs, The Dashboard, and Reports:

diff --git a/help_docs/ReadMe.md b/help_docs/ReadMe.md index d3693c71..5df77114 100755 --- a/help_docs/ReadMe.md +++ b/help_docs/ReadMe.md @@ -51,6 +51,8 @@
Webdriver Installation
Verify Webdriver Works
Console Scripts Tutorial
+
The Dashboard
+
Recorder Mode
Syntax Formats
Mobile Device Testing
Method Summary (API Ref)
@@ -95,6 +97,8 @@
Webdriver Installation
Verify Webdriver Works
Console Scripts Tutorial
+
The Dashboard
+
Recorder Mode
Syntax Formats
Mobile Device Testing
Method Summary (API Ref)
diff --git a/help_docs/method_summary.md b/help_docs/method_summary.md index caefe4e1..76842b5b 100755 --- a/help_docs/method_summary.md +++ b/help_docs/method_summary.md @@ -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... -[](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) +[](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) diff --git a/help_docs/recorder_mode.md b/help_docs/recorder_mode.md index a5dc1a0e..1ec0f0f6 100755 --- a/help_docs/recorder_mode.md +++ b/help_docs/recorder_mode.md @@ -76,6 +76,8 @@ class RecorderTest(BaseCase):

🔴 SeleniumBase 2.0.1 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.

+

🔴 SeleniumBase 2.0.2 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.

+ --------
To learn more about SeleniumBase, check out the Docs Site:
diff --git a/integrations/katalon/ReadMe.md b/integrations/katalon/ReadMe.md index 0ef005ad..f0e1458c 100755 --- a/integrations/katalon/ReadMe.md +++ b/integrations/katalon/ReadMe.md @@ -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() +``` + +
This can be improved on...
+ +After running seleniumbase convert [FILE.py] on it, here is the new result: + +```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') +``` + +This is much cleaner than the original version. +It also uses the more reliable SeleniumBase methods. diff --git a/integrations/selenium_ide/ReadMe.md b/integrations/selenium_ide/ReadMe.md index 0ef005ad..f0e1458c 100755 --- a/integrations/selenium_ide/ReadMe.md +++ b/integrations/selenium_ide/ReadMe.md @@ -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() +``` + +
This can be improved on...
+ +After running seleniumbase convert [FILE.py] on it, here is the new result: + +```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') +``` + +This is much cleaner than the original version. +It also uses the more reliable SeleniumBase methods. diff --git a/seleniumbase/utilities/selenium_ide/ReadMe.md b/seleniumbase/utilities/selenium_ide/ReadMe.md index 0ef005ad..f0e1458c 100755 --- a/seleniumbase/utilities/selenium_ide/ReadMe.md +++ b/seleniumbase/utilities/selenium_ide/ReadMe.md @@ -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() +``` + +
This can be improved on...
+ +After running seleniumbase convert [FILE.py] on it, here is the new result: + +```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') +``` + +This is much cleaner than the original version. +It also uses the more reliable SeleniumBase methods.