diff --git a/README.md b/README.md index 06219b1d..3276d146 100755 --- a/README.md +++ b/README.md @@ -1,24 +1,53 @@ -[](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
+

SeleniumBase

-[SeleniumBase](https://github.com/seleniumbase/SeleniumBase/releases) [ ](https://pypi.python.org/pypi/seleniumbase) [ ](https://gitter.im/seleniumbase/SeleniumBase) [ ](https://travis-ci.org/seleniumbase/SeleniumBase) [](https://github.com/seleniumbase/SeleniumBase/actions)
+

Create automated tests for web and mobile. βœ…

-A Python framework for Web UI testing and [site tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md) with [Selenium](https://selenium.dev/) and [pytest](https://docs.pytest.org/en/latest/index.html). +

SeleniumBase: A Python framework that uses pytest and WebDriver to make UI testing fast, easy, and reliable.

-
-(Above: [test_swag_labs.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_swag_labs.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in Demo Mode.)
+

+ +Latest Release on GitHub +Latest Release on PyPI +SeleniumBase on TravisCI +SeleniumBase GitHub Actions +SeleniumBase +SeleniumBase +

+ +

+πŸš€ Get Started | +🦚 Features | +πŸ§™β€β™‚οΈ CMD Options | +πŸ‘©β€πŸ« Examples | +πŸ“Š Sample Reports | +πŸ“– API | +πŸ“± Mobile Testing | +🚞 Site Tours | +πŸ‘©β€πŸŽ¨ Visual Testing | +🌎 Translations | +⏺️ Recorder | +🌐 Grid-Use | +πŸ‘©β€πŸ’» MasterQA Tool | +πŸ›©οΈ GitHub CI | +πŸ‘‹ Chat | +πŸ—ΊοΈ Releases +

+ +
+ +(Above: [test_swag_labs.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_swag_labs.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in Mobile Mode.)
+```bash +pytest test_swag_labs.py --mobile +``` +------ +
SeleniumBase's command-line options allow you to run the same test using different browsers and environments.
+ +(Below: [test_swag_labs.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_swag_labs.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in Demo Mode.) ```bash pytest test_swag_labs.py --demo ``` +
-## Features: -* Simplifies the process of creating of web & mobile tests. -* Includes [command-line options](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md) for making [reports](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md), etc. -* Uses reliable, smart-waiting code to prevent flakiness. -* Multiplies the abilities of [pytest](https://pytest.org) and enhances [Selenium](https://www.seleniumhq.org/). -* Includes tools for [assisted-QA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), [visual testing](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md), & [web tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md). -* Integrates with [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md), [Katalon Recorder](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_ide/ReadMe.md), & [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py). -* To see all features [click here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md). To see all methods, [click here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md). -* To see examples [click here](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md). To see all help docs, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/help_docs). ## Quick Start @@ -69,7 +98,29 @@ pytest my_first_test.py * On Linux ``--headless`` is the default behavior (running with no GUI). You can also run in headless mode on any OS. If your Linux machine has a GUI and you want to see the web browser as tests run, add ``--headed`` or ``--gui``. **Here's an example test, [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py):**
-
+```python +from seleniumbase import BaseCase + +class MyTestClass(BaseCase): + + def test_basic(self): + self.open("https://xkcd.com/353/") + self.assert_title("xkcd: Python") + self.assert_element('img[alt="Python"]') + self.click('a[rel="license"]') + self.assert_text("free to copy and reuse") + self.go_back() + self.click_link_text("About") + self.assert_text("xkcd.com", "h2") + self.open("://store.xkcd.com/collections/everything") + self.update_text("input.search-input", "xkcd book\n") + self.assert_exact_text("xkcd: volume 0", "h3") +``` +
+```bash +pytest my_first_test.py --demo +``` + * By default, **[CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp)** are used for finding page elements. * If you're new to CSS Selectors, games like [Flukeout](http://flukeout.github.io/) can help you learn. * Here are some common ``SeleniumBase`` methods you might find in tests: @@ -110,10 +161,14 @@ self.update_text("input", "dogs\n") The same command with regular WebDriver is very messy: (And it doesn't include SeleniumBase smart-waiting.) ```python -self.driver.find_element_by_css_selector("input").clear() # Not always needed -self.driver.find_element_by_css_selector("input").send_keys("dogs") -self.driver.find_element_by_css_selector("input").submit() +from selenium.webdriver.common.by import By +element = self.driver.find_element(by=By.CSS_SELECTOR, value="input") +element.clear() # Not always needed +element.send_keys("dogs") +element.submit() ``` +As you can see, the old WebDriver way is very bad! +Use SeleniumBase to make testing much easier! (You can still use ``self.driver`` in your code.) #### **Run tests with ``pytest`` or ``nosetests`` in any browser:**