From c94b54b45ed30beb149be90ce3f108ba47d6072a Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Thu, 8 Mar 2018 17:47:00 -0500 Subject: [PATCH] Update the Docs --- README.md | 48 +++++++++++++++++++-------------------- help_docs/command_line.md | 33 +++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index d36dd2e9..fe6d99e8 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ - + -All-in-one web automation platform designed to assist you with testing web applications. +
+Design and build reliable web automation with **SeleniumBase**'s all-in-one framework for easy end-to-end testing.

[![](https://img.shields.io/pypi/v/seleniumbase.svg)](https://pypi.python.org/pypi/seleniumbase) [![Build Status](https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master)](https://travis-ci.org/seleniumbase/SeleniumBase) [![Join the chat at https://gitter.im/seleniumbase/SeleniumBase](https://badges.gitter.im/seleniumbase/SeleniumBase.svg)](https://gitter.im/seleniumbase/SeleniumBase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -SeleniumBase helps you build amazing automation scripts in Python for controlling WebDriver on any cloud or local machine. Originally built for [testing HubSpot's platform](https://product.hubspot.com/blog/the-classic-qa-team-is-obsolete), and more, SeleniumBase was later open-sourced to benefit more users. +Take the hard work out of WebDriver: +SeleniumBase automatically takes care of tedious WebDriver actions such as spinning up & closing web browsers, creating screenshots for failing tests, using a proxy server, connecting to a Selenium Grid, etc. ([Read more](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/command_line.md)) Simple Python syntax makes coding easy:
(By default, [CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp) are used for finding page elements.) @@ -21,12 +23,9 @@ nosetests my_test_suite.py --browser=firefox Watch [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) run in [Demo Mode](#seleniumbase_demo_mode):
![](https://cdn2.hubspot.net/hubfs/100006/images/sb_demo.gif "SeleniumBase")
-(If you take out all the asserts from that test, you're left with the tiny [basic_script.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/basic_script.py).) +(If you remove all the asserts from that test, you're left with [basic_script.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/basic_script.py), which performs all the actions you can see when running the test.) -No more flaky tests:
-SeleniumBase automatically waits for page elements to finish loading before interacting with them (*up to a timeout limit*). This means you no longer need random ``time.sleep()`` statements in your code. - -SeleniumBase helps keep your code clean:
+No more messy code:
This long line of WebDriver code... ```python self.driver.find_element_by_css_selector("textarea").send_keys("text") @@ -37,14 +36,20 @@ self.update_text("textarea", "text") ``` (You can still use ``self.driver`` in your code.) -Business Mindset:
-SeleniumBase makes it easy to automate tedious business tasks. (*To learn about businesses using SeleniumBase, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/happy_customers.md).*) +No more flaky tests:
+SeleniumBase methods automatically wait for page elements to finish loading before interacting with them (*up to a timeout limit*). This means you no longer need random ``time.sleep()`` statements in your code. -Hybrid Automation:
+Assist manual QA with automation:
SeleniumBase includes an automated/manual hybrid solution called **[MasterQA](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/masterqa/ReadMe.md)**, which speeds up manual testing by having automation perform all the web browser actions while the manual tester only validates what is seen. -Works with all your favorite tools:
-[Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/selenium_grid), [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md), [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), and [AWS](#amazon_section). +Plays well with your favorite tools:
+SeleniumBase is compatible with [Selenium Grid](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/selenium_grid), [MySQL](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/testcase_manager.py), [Docker](https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/docker/ReadMe.md), [NodeJS](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/node_js), [Google Cloud](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/google_cloud/ReadMe.md), and [AWS](#amazon_section). + +Business mindset:
+SeleniumBase makes it easy to automate tedious business tasks. (*To learn about businesses using SeleniumBase, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/happy_customers.md).*) + +Extensive testing and made with love:
+SeleniumBase was originally built for [testing HubSpot's platform](https://product.hubspot.com/blog/the-classic-qa-team-is-obsolete) and automating business activites. Then in 2014, SeleniumBase was open-sourced to benefit users everywhere. It has grown significantly since then. For more HubSpot open-source projects, check out [github.com/hubspot](https://github.com/hubspot). ([See more SeleniumBase features](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md)) @@ -638,20 +643,15 @@ def get_delayed_test_data(self, testcase_address, done=0): Now you know how to pull data from your MySQL DB. -Delayed Data Manager usage example: If you scheduled an email to go out 12 hours from now and you wanted to check that the email gets received (but you don't want your test sitting idle for 12 hours) you can store the email credentials as a unique time-stamp for the email subject in the DB (along with a time for when it's safe for the email to be searched for) and then a later-running test can do the checking after the right amount of time has passed. +Delayed Data usage example: If you scheduled an email to go out 3 hours from now and you wanted to check that the email gets received (but you don't want your test sitting idle for 3 hours) you can store the email credentials as a unique time-stamp for the email subject in the DB (along with a time for when it's safe for the email to be searched for) and then a later-running test can do the checking after the right amount of time has passed. ### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Wrap-Up -Congratulations on making it through this ReadMe tutorial! +Congratulations on learning how to use **SeleniumBase**! -Questions or Comments? [![Join the chat at https://gitter.im/seleniumbase/SeleniumBase](https://badges.gitter.im/seleniumbase/SeleniumBase.svg)](https://gitter.im/seleniumbase/SeleniumBase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -Here are some other exciting open source projects on GitHub by smart people I've worked with: -[https://github.com/hubspot](https://github.com/hubspot) - -~ Michael Mintz
+Questions or Comments?
+[![Join the chat at https://gitter.im/seleniumbase/SeleniumBase](https://badges.gitter.im/seleniumbase/SeleniumBase.svg)](https://gitter.im/seleniumbase/SeleniumBase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[https://github.com/mdmintz](https://github.com/mdmintz)
-[https://www.linkedin.com/in/mdmintz](https://www.linkedin.com/in/mdmintz) - - +[https://www.linkedin.com/in/mdmintz](https://www.linkedin.com/in/mdmintz)
+ diff --git a/help_docs/command_line.md b/help_docs/command_line.md index 1981621b..ea22ac59 100755 --- a/help_docs/command_line.md +++ b/help_docs/command_line.md @@ -2,12 +2,13 @@ In addition to [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py), which allows you to customize the test framework, SeleniumBase gives you the flexibility to customize & control test runs from the command line: -* Set your browser there (default = Chrome) +* Set the browser for tests to use (Default: Chrome) * Change the automation speed (with Demo Mode) * Choose betweeen pytest & nose unittest runners * Specify what to log and where to store logs * Choose additional variables to pass into tests * Choose whether to enter Debug Mode on failures +* Specify a proxy server to connect to * Choose a database to save results to * Choose a Selenium Grid to connect to @@ -18,11 +19,19 @@ In addition to [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/m ```bash pytest my_first_test.py -nosetests my_first_test.py --browser=firefox - pytest my_first_test.py --demo_mode --browser=chrome -nosetests my_test_suite.py -s +nosetests my_first_test.py --browser=firefox + +pytest basic_script.py -s --pdb --pdb-failures + +pytest my_test_suite.py --server=IP_ADDRESS -n 4 + +pytest basic_script.py --html=report.html + +nosetests my_test_suite.py --report --show_report + +pytest my_test_suite.py --proxy=IP_ADDRESS:PORT ``` You can interchange **nosetests** with **pytest**. Chrome is the default browser if not specified. The ``-s`` option may produce additional output to make debugging easier. @@ -96,4 +105,18 @@ nosetests my_test_suite.py --report ``` ![](http://cdn2.hubspot.net/hubfs/100006/images/Test_Report_2.png "Example Nosetest Report") -(NOTE: You can add ``--show_report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show_report`` when running tests locally because it pauses the test run.) \ No newline at end of file +(NOTE: You can add ``--show_report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show_report`` when running tests locally because it pauses the test run.) + +#### **Using a Proxy Server:** + +If you wish to use a proxy server for your browser tests (Chrome and Firefox only), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command line. + +```bash +pytest proxy_test.py --proxy=IP_ADDRESS:PORT +``` + +To make things easier, you can add your frequently-used proxies to PROXY_LIST in [proxy_list.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/proxy_list.py), and then use ``--proxy=KEY_FROM_PROXY_LIST`` to use the IP_ADDRESS:PORT of that key. + +```bash +pytest proxy_test.py --proxy=proxy1 +```