From 2e2cd7171e4e95ca27ac1dc425a2dc95b464e5ff Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 5 Aug 2020 15:31:58 -0400 Subject: [PATCH] Update the docs --- examples/chart_maker/ReadMe.md | 182 +++++++++++++++-------------- help_docs/ReadMe.md | 39 ++++--- help_docs/chart_maker.md | 182 +++++++++++++++-------------- seleniumbase/config/proxy_list.py | 1 - seleniumbase/fixtures/base_case.py | 20 ++-- 5 files changed, 216 insertions(+), 208 deletions(-) diff --git a/examples/chart_maker/ReadMe.md b/examples/chart_maker/ReadMe.md index 109695b5..a8e0a4c9 100755 --- a/examples/chart_maker/ReadMe.md +++ b/examples/chart_maker/ReadMe.md @@ -8,7 +8,7 @@ SeleniumBase Chart Maker allows you to create HTML charts with Python. (Using Hi ([Click to see a presentation with multiple charts](https://seleniumbase.io/other/chart_presentation.html)) -Here's how to run the example presentation with a pie chart from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker): +Here's how to run a simple pie chart presentation from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker): ```bash cd examples/chart_maker @@ -31,7 +31,7 @@ class MyChartMakerClass(BaseCase): self.begin_presentation(filename="my_chart.html") ``` -Here's how to run an example presentation with multiple charts: (Press the right arrow to advance to the next slide) +Here's how to run an example presentation with multiple charts: ```bash cd examples/chart_maker @@ -53,7 +53,92 @@ Here are screenshots from the examples:
-### Creating new charts: +### Here's a line chart example: + +```python +from seleniumbase import BaseCase + +class MyChartMakerClass(BaseCase): + def test_chart_maker(self): + self.create_presentation() + self.create_line_chart( + title="Time Outside", subtitle="Last Week", unit="Minutes") + self.add_data_point("Sun", 5) + self.add_data_point("Mon", 10) + self.add_data_point("Tue", 20) + self.add_data_point("Wed", 40) + self.add_data_point("Thu", 80) + self.add_data_point("Fri", 65) + self.add_data_point("Sat", 50) + self.add_slide("

Line Chart

" + self.extract_chart()) + self.begin_presentation(filename="line_chart.html", interval=8) +``` + +#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command: + +```bash +pytest test_line_chart.py +``` + +Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.) + + +### For a more advanced example (multiple charts in a presentation): + +```python +from seleniumbase import BaseCase + +class MyChartMakerClass(BaseCase): + + def test_chart_maker_presentation(self): + self.create_presentation(theme="sky") + + self.create_pie_chart(title="Automated Tests") + self.add_data_point("Passed", 7, color="#95d96f") + self.add_data_point("Untested", 2, color="#eaeaea") + self.add_data_point("Failed", 1, color="#f1888f") + self.add_slide("

Pie Chart

" + self.extract_chart()) + + self.create_bar_chart(title="Language", libs=False) + self.add_data_point("Python", 33, color="Orange") + self.add_data_point("JavaScript", 27, color="Teal") + self.add_data_point("HTML + CSS", 21, color="Purple") + self.add_slide("

Bar Chart

" + self.extract_chart()) + + self.create_column_chart(title="Colors", libs=False) + self.add_data_point("Red", 10, color="Red") + self.add_data_point("Green", 25, color="Green") + self.add_data_point("Blue", 15, color="Blue") + self.add_slide("

Column Chart

" + self.extract_chart()) + + self.create_line_chart(title="Last Week's Data", libs=False) + self.add_data_point("Sun", 5) + self.add_data_point("Mon", 10) + self.add_data_point("Tue", 20) + self.add_data_point("Wed", 40) + self.add_data_point("Thu", 80) + self.add_data_point("Fri", 65) + self.add_data_point("Sat", 50) + self.add_slide("

Line Chart

" + self.extract_chart()) + + self.begin_presentation(filename="chart_presentation.html") +``` + +Here's how to run that example: + +```bash +cd examples/chart_maker +pytest chart_presentation.py +``` + +(Press the Right Arrow to advance to the next slide in that chart presentation) + +([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html)) + +Multi-Series charts can also be created. Try the available examples to learn more. + + +## Chart Maker API ```python self.create_pie_chart( @@ -151,8 +236,8 @@ self.create_area_chart( zero - If True, the y-axis always starts at 0. (Default: False). libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ ``` @@ -176,6 +261,7 @@ self.add_data_point(label, value, color=None, chart_name=None): """ ``` + ### Adding a new data series to an existing chart: ```python @@ -233,88 +319,4 @@ self.display_chart(chart_name=None, filename=None): """ ``` -All methods have the optional ``chart_name`` argument, which is only needed if you're creating multiple charts at the same time. - - -### Here's an example of using SeleniumBase Chart Maker: - -```python -from seleniumbase import BaseCase - -class MyChartMakerClass(BaseCase): - def test_chart_maker(self): - self.create_presentation() - self.create_line_chart( - title="Time Outside", subtitle="Last Week", unit="Minutes") - self.add_data_point("Sun", 5) - self.add_data_point("Mon", 10) - self.add_data_point("Tue", 20) - self.add_data_point("Wed", 40) - self.add_data_point("Thu", 80) - self.add_data_point("Fri", 65) - self.add_data_point("Sat", 50) - self.add_slide("

Line Chart

" + self.extract_chart()) - self.begin_presentation(filename="line_chart.html", interval=8) -``` - -#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command: - -```bash -pytest test_line_chart.py -``` - -Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.) - -### For a more advanced example (multiple charts in a presentation): - -```python -from seleniumbase import BaseCase - -class MyChartMakerClass(BaseCase): - - def test_chart_maker_presentation(self): - self.create_presentation(theme="sky") - - self.create_pie_chart(title="Automated Tests") - self.add_data_point("Passed", 7, color="#95d96f") - self.add_data_point("Untested", 2, color="#eaeaea") - self.add_data_point("Failed", 1, color="#f1888f") - self.add_slide("

Pie Chart

" + self.extract_chart()) - - self.create_bar_chart(title="Language", libs=False) - self.add_data_point("Python", 33, color="Orange") - self.add_data_point("JavaScript", 27, color="Teal") - self.add_data_point("HTML + CSS", 21, color="Purple") - self.add_slide("

Bar Chart

" + self.extract_chart()) - - self.create_column_chart(title="Colors", libs=False) - self.add_data_point("Red", 10, color="Red") - self.add_data_point("Green", 25, color="Green") - self.add_data_point("Blue", 15, color="Blue") - self.add_slide("

Column Chart

" + self.extract_chart()) - - self.create_line_chart(title="Last Week's Data", libs=False) - self.add_data_point("Sun", 5) - self.add_data_point("Mon", 10) - self.add_data_point("Tue", 20) - self.add_data_point("Wed", 40) - self.add_data_point("Thu", 80) - self.add_data_point("Fri", 65) - self.add_data_point("Sat", 50) - self.add_slide("

Line Chart

" + self.extract_chart()) - - self.begin_presentation(filename="chart_presentation.html") -``` - -Here's how to run that example: - -```bash -cd examples/chart_maker -pytest chart_presentation.py -``` - -(Press the Right Arrow to advance to the next slide in that chart presentation) - -([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html)) - -Multi-Series charts can also be created. Try the available examples to learn more. +All methods have the optional ``chart_name`` argument, which is only needed when storing multiple charts at the same time. diff --git a/help_docs/ReadMe.md b/help_docs/ReadMe.md index e4fc6ba3..afe76646 100755 --- a/help_docs/ReadMe.md +++ b/help_docs/ReadMe.md @@ -7,6 +7,7 @@
Features List
Command Line Tutorial
Usage Examples
+
Demo Page for Tests
How SeleniumBase Works
Installing Python, Pip, & Git
Python Virtual Env Tutorial
@@ -19,6 +20,8 @@
Language Translations
JS Package Manager
Tour Examples
+
Presentation Maker
+
Chart Maker
MySQL Installation Overview
Using the Selenium Grid
Browser Desired Capabilities
@@ -30,27 +33,29 @@

GitHub Pages ToC (seleniumbase.com)

-
Features List
-
Command Line Tutorial
+
Features List
+
Command Line Tutorial
Usage Examples
-
How SeleniumBase Works
-
Installing Python, Pip, & Git
-
Python Virtual Env Tutorial
-
SeleniumBase Installation
-
Webdriver Installation
-
Verify Webdriver Works
+
How SeleniumBase Works
+
Installing Python, Pip, & Git
+
Python Virtual Env Tutorial
+
SeleniumBase Installation
+
Webdriver Installation
+
Verify Webdriver Works
Console Scripts Tutorial
-
Mobile Device Testing
-
Method Summary (API Ref)
-
Language Translations
-
JS Package Manager
+
Mobile Device Testing
+
Method Summary (API Ref)
+
Language Translations
+
JS Package Manager
Tour Examples
-
MySQL Installation Overview
+
Presentation Maker
+
Chart Maker
+
MySQL Installation Overview
Using the Selenium Grid
-
Browser Desired Capabilities
-
Safari Driver Detailed Info
-
Seeing Hidden Files on macOS
-
Case Studies
+
Browser Desired Capabilities
+
Safari Driver Detailed Info
+
Seeing Hidden Files on macOS
+
Case Studies
-------- diff --git a/help_docs/chart_maker.md b/help_docs/chart_maker.md index 109695b5..a8e0a4c9 100755 --- a/help_docs/chart_maker.md +++ b/help_docs/chart_maker.md @@ -8,7 +8,7 @@ SeleniumBase Chart Maker allows you to create HTML charts with Python. (Using Hi ([Click to see a presentation with multiple charts](https://seleniumbase.io/other/chart_presentation.html)) -Here's how to run the example presentation with a pie chart from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker): +Here's how to run a simple pie chart presentation from [GitHub => seleniumbase/SeleniumBase/examples/chart_maker](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/chart_maker): ```bash cd examples/chart_maker @@ -31,7 +31,7 @@ class MyChartMakerClass(BaseCase): self.begin_presentation(filename="my_chart.html") ``` -Here's how to run an example presentation with multiple charts: (Press the right arrow to advance to the next slide) +Here's how to run an example presentation with multiple charts: ```bash cd examples/chart_maker @@ -53,7 +53,92 @@ Here are screenshots from the examples:
-### Creating new charts: +### Here's a line chart example: + +```python +from seleniumbase import BaseCase + +class MyChartMakerClass(BaseCase): + def test_chart_maker(self): + self.create_presentation() + self.create_line_chart( + title="Time Outside", subtitle="Last Week", unit="Minutes") + self.add_data_point("Sun", 5) + self.add_data_point("Mon", 10) + self.add_data_point("Tue", 20) + self.add_data_point("Wed", 40) + self.add_data_point("Thu", 80) + self.add_data_point("Fri", 65) + self.add_data_point("Sat", 50) + self.add_slide("

Line Chart

" + self.extract_chart()) + self.begin_presentation(filename="line_chart.html", interval=8) +``` + +#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command: + +```bash +pytest test_line_chart.py +``` + +Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.) + + +### For a more advanced example (multiple charts in a presentation): + +```python +from seleniumbase import BaseCase + +class MyChartMakerClass(BaseCase): + + def test_chart_maker_presentation(self): + self.create_presentation(theme="sky") + + self.create_pie_chart(title="Automated Tests") + self.add_data_point("Passed", 7, color="#95d96f") + self.add_data_point("Untested", 2, color="#eaeaea") + self.add_data_point("Failed", 1, color="#f1888f") + self.add_slide("

Pie Chart

" + self.extract_chart()) + + self.create_bar_chart(title="Language", libs=False) + self.add_data_point("Python", 33, color="Orange") + self.add_data_point("JavaScript", 27, color="Teal") + self.add_data_point("HTML + CSS", 21, color="Purple") + self.add_slide("

Bar Chart

" + self.extract_chart()) + + self.create_column_chart(title="Colors", libs=False) + self.add_data_point("Red", 10, color="Red") + self.add_data_point("Green", 25, color="Green") + self.add_data_point("Blue", 15, color="Blue") + self.add_slide("

Column Chart

" + self.extract_chart()) + + self.create_line_chart(title="Last Week's Data", libs=False) + self.add_data_point("Sun", 5) + self.add_data_point("Mon", 10) + self.add_data_point("Tue", 20) + self.add_data_point("Wed", 40) + self.add_data_point("Thu", 80) + self.add_data_point("Fri", 65) + self.add_data_point("Sat", 50) + self.add_slide("

Line Chart

" + self.extract_chart()) + + self.begin_presentation(filename="chart_presentation.html") +``` + +Here's how to run that example: + +```bash +cd examples/chart_maker +pytest chart_presentation.py +``` + +(Press the Right Arrow to advance to the next slide in that chart presentation) + +([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html)) + +Multi-Series charts can also be created. Try the available examples to learn more. + + +## Chart Maker API ```python self.create_pie_chart( @@ -151,8 +236,8 @@ self.create_area_chart( zero - If True, the y-axis always starts at 0. (Default: False). libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ ``` @@ -176,6 +261,7 @@ self.add_data_point(label, value, color=None, chart_name=None): """ ``` + ### Adding a new data series to an existing chart: ```python @@ -233,88 +319,4 @@ self.display_chart(chart_name=None, filename=None): """ ``` -All methods have the optional ``chart_name`` argument, which is only needed if you're creating multiple charts at the same time. - - -### Here's an example of using SeleniumBase Chart Maker: - -```python -from seleniumbase import BaseCase - -class MyChartMakerClass(BaseCase): - def test_chart_maker(self): - self.create_presentation() - self.create_line_chart( - title="Time Outside", subtitle="Last Week", unit="Minutes") - self.add_data_point("Sun", 5) - self.add_data_point("Mon", 10) - self.add_data_point("Tue", 20) - self.add_data_point("Wed", 40) - self.add_data_point("Thu", 80) - self.add_data_point("Fri", 65) - self.add_data_point("Sat", 50) - self.add_slide("

Line Chart

" + self.extract_chart()) - self.begin_presentation(filename="line_chart.html", interval=8) -``` - -#### This example is from [test_line_chart.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/chart_maker/test_line_chart.py), which you can run from the ``examples/chart_maker`` folder with the following command: - -```bash -pytest test_line_chart.py -``` - -Because that presentation above has an ``interval`` set to ``8``, it will automatically advance to the next slide after 8 seconds. (Or exit if there are no more slides.) - -### For a more advanced example (multiple charts in a presentation): - -```python -from seleniumbase import BaseCase - -class MyChartMakerClass(BaseCase): - - def test_chart_maker_presentation(self): - self.create_presentation(theme="sky") - - self.create_pie_chart(title="Automated Tests") - self.add_data_point("Passed", 7, color="#95d96f") - self.add_data_point("Untested", 2, color="#eaeaea") - self.add_data_point("Failed", 1, color="#f1888f") - self.add_slide("

Pie Chart

" + self.extract_chart()) - - self.create_bar_chart(title="Language", libs=False) - self.add_data_point("Python", 33, color="Orange") - self.add_data_point("JavaScript", 27, color="Teal") - self.add_data_point("HTML + CSS", 21, color="Purple") - self.add_slide("

Bar Chart

" + self.extract_chart()) - - self.create_column_chart(title="Colors", libs=False) - self.add_data_point("Red", 10, color="Red") - self.add_data_point("Green", 25, color="Green") - self.add_data_point("Blue", 15, color="Blue") - self.add_slide("

Column Chart

" + self.extract_chart()) - - self.create_line_chart(title="Last Week's Data", libs=False) - self.add_data_point("Sun", 5) - self.add_data_point("Mon", 10) - self.add_data_point("Tue", 20) - self.add_data_point("Wed", 40) - self.add_data_point("Thu", 80) - self.add_data_point("Fri", 65) - self.add_data_point("Sat", 50) - self.add_slide("

Line Chart

" + self.extract_chart()) - - self.begin_presentation(filename="chart_presentation.html") -``` - -Here's how to run that example: - -```bash -cd examples/chart_maker -pytest chart_presentation.py -``` - -(Press the Right Arrow to advance to the next slide in that chart presentation) - -([Click to see a live example of that presentation](https://seleniumbase.io/other/chart_presentation.html)) - -Multi-Series charts can also be created. Try the available examples to learn more. +All methods have the optional ``chart_name`` argument, which is only needed when storing multiple charts at the same time. diff --git a/seleniumbase/config/proxy_list.py b/seleniumbase/config/proxy_list.py index e8aa3235..a0fb1214 100755 --- a/seleniumbase/config/proxy_list.py +++ b/seleniumbase/config/proxy_list.py @@ -21,7 +21,6 @@ you can try finding one from one of following sites: PROXY_LIST = { "example1": "82.200.233.4:3128", # (Example) - set your own proxy here - "example2": "105.112.8.53:3128", # (Example) - set your own proxy here "proxy1": None, "proxy2": None, "proxy3": None, diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index 8cdc0449..b39507f7 100755 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -3498,8 +3498,8 @@ class BaseCase(unittest.TestCase): unit - The description label given to the chart's y-axis values. libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ if not chart_name: @@ -3524,8 +3524,8 @@ class BaseCase(unittest.TestCase): unit - The description label given to the chart's y-axis values. libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ if not chart_name: @@ -3550,8 +3550,8 @@ class BaseCase(unittest.TestCase): unit - The description label given to the chart's y-axis values. libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ if not chart_name: @@ -3577,8 +3577,8 @@ class BaseCase(unittest.TestCase): zero - If True, the y-axis always starts at 0. (Default: False). libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ if not chart_name: @@ -3604,8 +3604,8 @@ class BaseCase(unittest.TestCase): zero - If True, the y-axis always starts at 0. (Default: False). libs - The option to include Chart libraries (JS and CSS files). Should be set to True (default) for the first time creating - a chart on a web page. If creating multiple charts on - a web page, you no longer need to re-import the libraries + a chart on a web page. If creating multiple charts on the + same web page, you won't need to re-import the libraries when creating additional charts. """ if not chart_name: