From 45e078775a78de5a6999f7c8c27423181af2838d Mon Sep 17 00:00:00 2001
From: Michael Mintz
-
Better web testing with Selenium and pytest.
+Better web testing with Selenium and pytest.
@@ -918,11 +918,11 @@ pytest --reruns=1 --reruns-delay=1
--rec
command-line arg, you can also call self.activate_recorder()
from your tests. This is only useful for tests that stay on the same URL because the Recorder will turn off when leaving the page where you activated the Recorder. The reason for this is because the standard Recorder Mode functions as a Chrome extension (and persists wherever the browser goes), whereas the method call version of Recorder Mode only lives in the page where it was called.
-🔴 (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.)
+🔴 (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.)
🔴 Inside recorded tests, you might find the self.open_if_not_url(URL)
method, which opens 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 browser action (such as a click) has brought the test to that page. This method not only prevents an extra page load if not needed, but it also lets people know what page the test went to after a browser action was performed.