From c5aea333c7742eefee52e9090a826a7b70574790 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Tue, 17 May 2022 22:56:38 -0400 Subject: [PATCH] Update the ReadMe --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e64b2242..e51c306f 100755 --- a/README.md +++ b/README.md @@ -694,7 +694,8 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1

Production Environments & Integrations:

-🔵 Here are some things you can do to set up a production environment for your testing: +
+🔵 Here are some things you can do to set up a production environment for your testing. * You can set up a [Jenkins](https://jenkins.io/) build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the SeleniumBase Jenkins example on Azure or the SeleniumBase Jenkins example on Google Cloud. @@ -706,12 +707,15 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1 * If you're using AWS, you can set up an [Amazon S3](https://aws.amazon.com/s3/) account for saving log files and screenshots from your tests. To activate this feature, modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details in the S3 section, and add "``--with-s3-logging``" on the command-line when running your tests. -Here's an example of running tests with additional features enabled: +Here's an example of running tests with some additional features enabled: ```bash pytest [YOUR_TEST_FILE.py] --with-db-reporting --with-s3-logging ``` +
+ +

Detailed Method Specifications and Examples:

@@ -922,7 +926,8 @@ You'd know this because the web page would contain something like the following self.activate_jquery() ``` -🔵 Here are some examples of using jQuery in your scripts: +
+🔵 Here are some examples of using jQuery in your scripts. ```python self.execute_script("jQuery, window.scrollTo(0, 600)") # Scrolling the page @@ -946,9 +951,12 @@ self.execute_script("return jQuery('textarea')[2].value") # Returns the css "va (Most of the above commands can be done directly with built-in SeleniumBase methods.) +
+ 🔵 Some websites have a restrictive [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) to prevent users from loading jQuery and other external libraries onto their websites. If you need to use jQuery or another JS library on such a website, add ``--disable-csp`` on the command-line. -🔵 In the next example, JavaScript creates a referral button on a page, which is then clicked: +
+🔵 In this example, JavaScript creates a referral button on a page, which is then clicked. ```python start_page = "https://xkcd.com/465/" @@ -961,6 +969,8 @@ self.click("a.analytics") # Clicks the generated button (Due to popular demand, this traffic generation example has been included in SeleniumBase with the ``self.generate_referral(start_page, end_page)`` and the ``self.generate_traffic(start_page, end_page, loops)`` methods.) +
+ 🔵 Using deferred asserts:

Let's say you want to verify multiple different elements on a web page in a single test, but you don't want the test to fail until you verified several elements at once so that you don't have to rerun the test to find more missing elements on the same page. That's where deferred asserts come in. Here's the example: