Selenium is the best thing that happened to test automation. SeleniumBase is the best thing that happened to Selenium.
Roman Savin
Test Automation Engineer | Educator | Writer | PayPal, Evernote, Chegg, QA Mentor
Dear colleagues,
I want to thank a great man, Michael Mintz , for creating and maintaining SeleniumBase. When you start using SeleniumBase, I promise you’ll thank Michael in your thoughts daily.
What is SeleniumBase? It’s an easy-to-use yet powerful and customizable Python-based test automation framework built over Selenium WebDriver.
Here is why I LOVE SeleniumBase and recommend it for your next automation project:
1. SeleniumBase uses Python — an easy-to-learn, popular, and powerful programming language. With Python, you can install many packages to take your automation framework to the next level: databases, data visualization, web scraping, machine learning, you name it.
2. Selenium WebDriver is like a LEGO. You can build whatever you want, but you must start from scratch. If you want to do serious web UI automation, you’ll need to spend a lot of time creating a framework over Selenium or take your custom framework from project to project.
Selenium WebDriver:?
element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, locator))
element.click()
SeleniumBase:
self.click(locator, timeout=10)
3. SeleniumBase uses Pytest — a modern framework for Python test automation. Command line options allow a high level of customization for your test runs, including reruns, time limits, extra test data, headless, demo, etc.
You can also use unittest, nose, and behave.?
4. Your tests are auto-discovered. Command:
pytest MyDir
will run all test suites under MyDir/ and nested directories.
If you want to run a concrete test suite or test case, specify the test suite name, test class name, and/or test case name:
pytest MyDir/test_suite_login.py
runs all tests inside test_suite_login.py
pytest MyDir/test_suite_login.py::NegativeTests
runs all tests under class NegativeTests inside test_suite_login.py
pytest MyDir/test_suite_login.py::NegativeTests::test_case_1
runs test_case_1 that belongs to the class NegativeTests inside test_suite_login.py
5. SeleniumBase comes with examples/ folder. Many examples, including parameterized test cases, will help you learn fast. In addition to examples, Michael has uploaded educational videos to his YouTube channel.
General Tutorial:
领英推荐
Recorder Tutorial:
6. If your test case fails, SeleniumBase will automatically produce a nicely formatted report with a detailed execution log and screenshot.
BTW, SeleniumBase methods automatically wait for page elements to finish loading before interacting with them (up to a timeout limit). No more flaky tests!
7. No more pain to work with iframes, alerts, dialogs, new tabs, windows, and file downloads — there is a method for everything. For example, here are methods related to file download:
self.get_downloads_folder()
self.get_browser_downloads_folder()
self.get_downloaded_files(regex=None, browser=False)
self.get_path_of_downloaded_file(file, browser=False)
self.get_data_from_downloaded_file(file, timeout=None, browser=False)
self.is_downloaded_file_present(file, browser=False)
self.is_downloaded_file_regex_present(regex, browser=False)
self.delete_downloaded_file_if_present(file, browser=False)
self.assert_downloaded_file(file, timeout=None, browser=False)
self.assert_downloaded_file_regex(regex, timeout=None, browser=False)
self.assert_data_in_downloaded_file(data, file, timeout=None, browser=False)?
8. Informative and cool-looking Dashboard displays execution progress in real-time.
9. If needed, you can access Selenium WebDriver methods directly.
10. SeleniumBase runs tests in Chrome, Safari, Edge, and Firefox. You can install it on Windows, MacOS, and Linux.
There are tens of other reasons to use SeleniumBase. Check it out, and you’ll be impressed just as everybody who automates with it.
Thank you, Michael!!
Automation Engineering Lead at iboss
11 个月Awesome summary! Thanks so much for writing this!