Releases: seleniumbase/SeleniumBase
Recorder updates: Improve "Choose File" processing and more
Recorder updates: Improve "Choose File" processing and more
- Make improvements around recording "Choose File" events.
- Remove a debugging statement from the previous release.
- Update Python dependencies:
--filelock==3.3.0;python_version>="3.6"',
Updates to Recorder Mode and the Page Objects generator
Updates to Recorder Mode and the Page Objects generator
- Add more selector options for Recorder Mode.
- Improve the Recorder Mode generator for hover_and_click.
- Add more options to the Page Objects generator.
- Refresh Python dependencies:
--setuptools>=58.2.0;python_version>="3.6"
Improve the "Recorder Mode" test generator
Improve the "Recorder Mode" test generator
🔴 SeleniumBase 1.66.5
improves the algorithm for converting recorded actions into SeleniumBase code.
Other changes:
- Update the custom_settings parser:
-- AddSWITCH_TO_NEW_TABS_ON_CLICK
to parsed items. - Update Python dependencies:
--filelock==3.2.0
Recorder Mode updates and more
Recorder Mode updates and more
- Add better error-handling for Recorder Mode.
- Improve the export abilities of The Recorder.
- Update the built-in ad-blocker.
-- Update the block list.
-- Fix an infinite loop that occurs during headless mode. - Remove unneeded Firefox options.
- Update default driver versions for "sbase install DRIVER":
-- Geckodriver upgrades tov0.30.0
. - Improve Dashboard updates during multi-threaded mode.
- If a click opens a new tab, switch to it automatically.
- Add more options when saving a screenshot:
-- Can now get a screenshot of a specific web element. - Refresh Python dependencies:
--filelock==3.1.0
-- Drop unneededPyOpenSSL
"Recorder Mode" optimizations
"Recorder Mode" optimizations
-
🔴 SeleniumBase
1.66.3
improves the algorithm for generating efficient selectors. Additionally, single and double quotes in selectors will now be properly escaped with backslashes as needed.
Recorder Mode improvements (and more)
Recorder Mode improvements (and more)
- Make improvements to Recorder Mode:
🔴 SeleniumBase 1.66.2
adds the ability to save selectors using the ":contains(TEXT)"
selector. If a Python file being recorded has multiple tests being run, then all those tests will get saved to the generated *_rec.py
file. The Recorder will now save common self.assert_*
calls made during tests. In order to escape iframes when using self.set_content_to_frame(frame)
, a new method was added: self.set_content_to_default()
. The self.set_content_to_*()
methods will be automatically used in place of self.switch_to_*()
methods in Recorder Mode, unless a test explicitly calls self._rec_overrides_switch = False
before the self.switch_to_*()
methods are called. Additionally, if an iframe contains the src
attribute, that page will get loaded in a new tab when switching to it in Recorder Mode.
Other changes include:
- Add the "--recorder" option to the output of "sbase options".
- Transform the "ad-block" feature into a Chromium extension.
- Refresh Python dependencies:
--setuptools>=58.1.0;python_version>="3.6"
--urllib3==1.26.7
--ipython==7.28.0;python_version>="3.7"
--platformdirs==2.4.0;python_version>="3.6"
--virtualenv>=20.8.1
--rich==10.11.0;python_version>="3.6"
Make improvements to "Recorder Mode"
Make improvements to "Recorder Mode"
- Make improvements to "Recorder Mode":
-- Record changes to file-chooserinput
fields. - Add method:
self.set_content_to_frame(frame)
- Add method:
self.show_file_choosers()
- Update Python dependencies:
--pytest-xdist==2.4.0;python_version>="3.6"
Add SeleniumBase "Recorder Mode"
Add SeleniumBase "Recorder Mode"
🔴 SeleniumBase Recorder Mode gives you the power to create automation scripts from manual browser actions.
(Only Chromium browsers such as Chrome and Edge are supported.)
🔴 To activate Recorder Mode, add --recorder
to your pytest
run command when running an existing test: (Also add -s
to allow breakpoints, unless you already have a pytest.ini
file present with --capture=no
in it.)
pytest TEST_NAME.py --recorder -s
🔴 To add your own actions inside the test, you'll need to create a breakpoint somewhere inside of it:
import pdb; pdb.set_trace()
🔴 Once you've reached the breakpoint, you can take control of the browser and add in any actions that you want recorded. When you are finished recording, type "c
" on the command-line and press [Enter]
to let the test continue from the breakpoint. After the test completes, a file called TEST_NAME_rec.py
will be automatically created in the ./recordings
folder, which will include the actions performed by the test, and the manual actions that you added in. Below is a command-line notification:
>>> RECORDING saved to: recordings/my_first_test_rec.py
*******************************************************
🔴 While a recording is in progress, you can hit the [ESC]
key to pause the recording. To resume the recording, you can hit the [~`]
key, which is located directly below the [ESC]
key on most keyboards.
🔴 If you want to create a recording from scratch, just run:pytest --recorder
on a Python file such as this one:
from seleniumbase import BaseCase
class RecorderTest(BaseCase):
def test_recorder(self):
import pdb; pdb.set_trace()
🔴 The above file gives you a basic SeleniumBase file with a breakpoint in it so that you can immediately start recording after you've opened a new web page in the browser.
🔴 Recorder Mode works by saving your recorded actions into the browser's sessionStorage
. SeleniumBase then reads from the browser's sessionStorage
to take the raw data and generate a full test from it. Keep in mind that sessionStorage
is only present for a website while the browser tab remains on a web page of the same domain/origin. If you leave that domain/origin, the sessionStorage
of that tab will no longer have the raw data that SeleniumBase needs to create a full recording. To compensate for this, all links to web pages of a different domain/origin will automatically open a new tab for you while in Recorder Mode. Additionally, the SeleniumBase self.open(URL)
method will also open a new tab for you in Recorder Mode if the domain/origin is different from the current URL. When the recorded test completes, SeleniumBase will scan the sessionStorage
of all open browser tabs for the data it needs to generate the complete SeleniumBase automation script.
🔴 If you just want to record actions on a single URL of a multi-URL test, you can call self.activate_recorder()
from the test instead of using pytest --recorder
from the command-line. When doing so, make sure that the browser tab is still on the same domain/origin at the end of the test, or else SeleniumBase will not have access to the sessionStorage
data that it needs for generating a complete test.
🔴 (Note that same domain/origin is not the same as same URL. Example: https://xkcd.com/353/
and https://xkcd.com/1537/
are two different URLs with the same domain/origin. That means that both URLs will share the same sessionStorage
data, and that any changes to sessionStorage
from one URL will carry on to the sessionStorage
of a different URL when the domain/origin is the same. If you want to find out a website's origin during a test, just call: self.get_origin()
, which returns the value of window.location.origin
from the browser's console.)
🔴 The launch of Recorder Mode has brought a new SeleniumBase method along with it: self.open_if_not_url(URL)
. This method will open the URL given if the browser is not currently on that page. This is used as a method in recorded scripts when SeleniumBase detects that a click action has already brought the test to the given page. This method not only prevents an extra page load if not needed, but it also lets people know the current page of the browser at that point in the test.
Other changes in this release include:
- Make the "Disable-CSP" extension more efficient.
- Make improvements to
self.set_value()
to account for event listeners. - Add
self.click_active_element()
. - Make improvements to the SeleniumBase Dashboard.
- Update Python dependencies:
--setuptools>=58.0.4;python_version>="3.6"
--setuptools-scm>=6.3.2;python_version>="3.6"
--charset-normalizer==2.0.6;python_version>="3.5"
--more-itertools==8.10.0;python_version>="3.5"
--pytest-rerunfailures==10.2;python_version>="3.6"
--beautifulsoup4==4.10.0;python_version>="3.5"
--decorator==5.1.0;python_version>="3.5"
--virtualenv>=20.8.0
--rich==10.10.0;python_version>="3.6"
Make improvements to SeleniumBase Visual Testing
Make improvements to SeleniumBase Visual Testing
- The
self.check_window()
method gets thecheck_domain
arg.
--check_domain
defaults toTrue
.
-- Ifcheck_domain
is set toFalse
, the domain check won't occur. - Improvements were also made to the layout comparison outputs.
self.check_window(name="default", level=0, baseline=False, check_domain=True)
For the Visual Testing docs, see:
https://seleniumbase.io/examples/visual_testing/ReadMe/
For the Visual Testing YouTube video, see:
https://www.youtube.com/watch?v=erwkoiDeNzA
Other changes:
- Change default button colors for IntroJS Tours.
- Refresh Python dependencies:
--setuptools>=58.0.2;python_version>="3.6"
--matplotlib-inline==0.1.3;python_version>="3.7"
Use the "https" protocol for the Grid Server if the port is "443"
Use the "https" protocol for the Grid Server if the port is "443"
(This only effects tests that are configured to run on a Selenium Grid Server.)
- Also update Python dependencies:
--setuptools>=58.0.0;python_version>="3.6"
--setuptools-scm>=6.3.1;python_version>="3.6"
--tomli>=1.2.1;python_version>="3.6"
--more-itertools==8.9.0;python_version>="3.5"
--Pillow==8.3.2;python_version>="3.6"