Releases: seleniumbase/SeleniumBase
Update default Chromium options and more
Update default Chromium options and more
- Update default Chrome and Edge (Chromium) options
- Update the NodeJS Express Test Runner App
- Update Python dependencies
--setuptools>=49.3.1;python_version>="3.5"
--prompt-toolkit==3.0.6;python_version>="3.6.1"
--rich==5.1.2;python_version>="3.6" and python_version<"4.0"
Bring back support for Microsoft Edge
Bring back support for Microsoft Edge
- Usage:
--browser=edge
- Fix #549
Make it easy to get started
Make it easy to get started
- Add a console script for displaying common pytest options
- Improve the NodeJS Python test launcher
- Update Messenger theme and dependencies
- Fix a bug with the smart Python word-wrap utility
- Update SeleniumBase translations
- Update the examples
- Refactor command line options and docs
- Refactor custom settings
- Update ad_block_list
- Add a custom pytest marker ("active")
Demo Mode updates and more
Demo Mode updates and more
- Update Demo Mode (new Messenger theme)
- Update Firefox default settings
- Clear out console logs before opening or refreshing pages
- Add meta charset data to the head of html presentations
- Update SeleniumBase translations
- Update Python dependencies
Add Presenter slide transitions, and more
Add Presenter slide transitions, and more
- Add the ability to set a presentation transition style
-- Transition Themes: "none", "slide", "fade", "zoom", "convex", "concave"
Additionally:
- Update SeleniumBase transitions
- Update Python dependencies
- Update the examples
- Update the docs
Upgrade pytest and Chart Maker
Upgrade pytest
and Chart Maker
- Upgrade
pytest
to version6.0.1
andpy
to version1.9.0
:
--pytest==6.0.1
--py==1.9.0
- Also update Python dependencies:
pip
,pyotp
, andrich
:
--pip>=20.2
--pyotp==2.4.0
--rich==4.2.1
- Add the ability to create area charts with Chart Maker:
Here are other charts you can build with SeleniumBase Chart Maker:
Bug fixes and test updates
Bug fixes and test updates
- Fix double_click() for older versions of ChromeDriver
- Race through chart display if running in headless mode
- Update example tests
Add the ability to create line charts and more (Chart Maker)
Add the ability to create line charts and more (with Chart Maker)
SeleniumBase Chart Maker allows you to create HTML charts with Python.
The HighCharts library is used for creating charts.
Here's a sample chart:
(Click on the image for an actual chart demo)
Here's how to run the example:
cd examples/chart_maker
pytest my_chart.py
Creating a new chart:
self.create_pie_chart(
chart_name=None, title=None, subtitle=None,
data_name=None, unit=None, libs=True):
""" Creates a JavaScript pie chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
subtitle - The subtitle displayed for the chart.
data_name - Set the series name. Useful for multi-series charts.
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
when creating additional charts.
"""
self.create_bar_chart(
chart_name=None, title=None, subtitle=None,
data_name=None, unit=None, libs=True):
""" Creates a JavaScript bar chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
subtitle - The subtitle displayed for the chart.
data_name - Set the series name. Useful for multi-series charts.
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
when creating additional charts.
"""
self.create_column_chart(
chart_name=None, title=None, subtitle=None,
data_name=None, unit=None, libs=True):
""" Creates a JavaScript column chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
subtitle - The subtitle displayed for the chart.
data_name - Set the series name. Useful for multi-series charts.
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
when creating additional charts.
"""
self.create_line_chart(
chart_name=None, title=None, subtitle=None,
data_name=None, unit=None, zero=False, libs=True):
""" Creates a JavaScript column chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
subtitle - The subtitle displayed for the chart.
data_name - Set the series name. Useful for multi-series charts.
unit - The description label given to the chart's y-axis values.
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
when creating additional charts.
"""
If creating multiple charts at the same time, you can pass the chart_name
parameter to distinguish between different charts.
Adding a data point to a chart:
self.add_data_point(label, value, color=None, chart_name=None):
""" Add a data point to a SeleniumBase-generated chart.
@Params
label - The label name for the data point.
value - The numeric value of the data point.
color - The HTML color of the data point.
Can be an RGB color. Eg: "#55ACDC".
Can also be a named color. Eg: "Teal".
chart_name - If creating multiple charts,
use this to select which one.
"""
Adding a new data series to an existing chart:
self.add_series_to_chart(self, data_name=None, chart_name=None):
""" Add a new data series to an existing chart.
This allows charts to have multiple data sets.
@Params
data_name - Set the series name. Useful for multi-series charts.
chart_name - If creating multiple charts,
use this to select which one.
"""
Saving a chart to a file:
self.save_chart(chart_name=None, filename=None):
""" Saves a SeleniumBase-generated chart to a file for later use.
@Params
chart_name - If creating multiple charts at the same time,
use this to select the one you wish to use.
filename - The name of the HTML file that you wish to
save the chart to. (filename must end in ".html")
"""
The full HTML of the chart is saved to the saved_charts/
folder.
Extracting the HTML of a chart:
self.extract_chart(chart_name=None):
""" Extracts the HTML from a SeleniumBase-generated chart.
@Params
chart_name - If creating multiple charts at the same time,
use this to select the one you wish to use.
"""
Displaying a chart in the browser window:
self.display_chart(chart_name=None, filename=None):
""" Displays a SeleniumBase-generated chart in the browser window.
@Params
chart_name - If creating multiple charts at the same time,
use this to select the one you wish to use.
filename - The name of the HTML file that you wish to
save the chart to. (filename must end in ".html")
interval - The delay time for auto-advancing charts. (in seconds)
If set to 0 (default), auto-advancing is disabled.
"""
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:
from seleniumbase import BaseCase
class MyChartMakerClass(BaseCase):
def test_chart_maker(self):
self.create_presentation()
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("<p>Pie Chart</p>" + self.extract_chart())
self.begin_presentation(filename="my_chart.html")
This example is from my_chart.py, which you can run from the examples/chart_maker
folder with the following command:
pytest my_chart.py
For a more advanced example (multiple charts in a presentation):
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("<p>Pie Chart</p>" + 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("<p>Bar Chart</p>" + 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("<p>Column Chart</p>" + 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("<p>Line Chart</p>" + self.extract_chart())
self.begin_presentation(filename="chart_presentation.html")
Here's how to run that example:
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)
Multi-Series charts can also be created. Try the available examples to learn more.
Also update Python dependencies:
- pytest-forked==1.3.0
- pytest-xdist==1.34.0
- rich==4.2.0
Add the ability to create bar charts and column charts
Add the ability to create bar charts and column charts with Chart Maker
SeleniumBase Chart Maker allows you to create HTML charts with Python.
The HighCharts library is used for creating charts.
Here's a sample chart:
(Click on the image for the actual chart)
Here's how to run the example (multiple charts in a presentation):
cd examples/chart_maker
pytest my_chart.py
(Press the Right Arrow to advance to the next slide in the chart presentation)
Creating a new chart:
self.create_pie_chart(chart_name=None, title="My Chart", libs=True)
""" Creates a JavaScript pie chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
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
when creating additional charts.
"""
self.create_bar_chart(chart_name=None, title="My Chart", libs=True)
""" Creates a JavaScript bar chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
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
when creating additional charts.
"""
self.create_column_chart(chart_name=None, title="My Chart", libs=True)
""" Creates a JavaScript column chart using "HighCharts".
@Params
chart_name - If creating multiple charts,
use this to select which one.
title - The title displayed for the chart.
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
when creating additional charts.
"""
If creating multiple charts at the same time, you can pass the chart_name
parameter to distinguish between different charts.
Adding a data point to a chart:
self.add_data_point(label, value, color=None, chart_name=None):
""" Add a data point to a SeleniumBase-generated chart.
@Params
label - The label name for the data point.
value - The numeric value of the data point.
color - The HTML color of the data point.
Can be an RGB color. Eg: "#55ACDC".
Can also be a named color. Eg: "Teal".
chart_name - If creating multiple charts,
use this to select which one.
"""
Saving a chart to a file:
self.save_chart(chart_name=None, filename=None):
""" Saves a SeleniumBase-generated chart to a file for later use.
@Params
chart_name - If creating multiple charts at the same time,
use this to select the one you wish to use.
filename - The name of the HTML file that you wish to
save the chart to. (filename must end in ".html")
"""
The full HTML of the chart is saved to the saved_charts/
folder.
Extracting the HTML of a chart:
self.extract_chart(chart_name=None):
""" Extracts the HTML from a SeleniumBase-generated chart.
@Params
chart_name - If creating multiple charts at the same time,
use this to select the one you wish to use.
"""
Displaying a chart in the browser window:
self.display_chart(chart_name=None, filename=None):
""" Displays a SeleniumBase-generated chart in the browser window.
@Params
chart_name - If creating multiple charts at the same time,
use this to select the one you wish to use.
filename - The name of the HTML file that you wish to
save the chart to. (filename must end in ".html")
"""
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:
from seleniumbase import BaseCase
class MyChartMakerClass(BaseCase):
def test_chart_maker(self):
self.create_presentation()
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(self.extract_chart())
self.create_bar_chart(title="Code", 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(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(self.extract_chart())
self.begin_presentation()
This example is from my_chart.py, which you can run from the examples/chart_maker
folder with the following command:
pytest my_chart.py
Add SeleniumBase "Chart Maker" for creating pie charts
Add SeleniumBase "Chart Maker" for creating pie charts
SeleniumBase Chart Maker allows you to create HTML charts with Python.
The HighCharts library is used for creating charts.
(Currently only pie charts are supported.)
Here's a sample chart:
(Click on the image for the actual chart)
Here's how to run the example (a chart in a presentation):
cd examples/chart_maker
pytest my_chart.py
Other changes included in this release:
- Update SeleniumBase Tours
- Update Python dependencies:
**parso==0.7.1
**coverage==5.2.1
**rich==4.1.0
**allure-pytest==2.8.17
**pdfminer.six==20200726