-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""A SeleniumBase test that loads cookies to bypass login.""" | ||
from seleniumbase import SB | ||
|
||
# Log in to Swag Labs and save cookies | ||
with SB(test=True) as sb: | ||
sb.open("https://www.saucedemo.com") | ||
sb.wait_for_element("div.login_logo") | ||
sb.type("#user-name", "standard_user") | ||
sb.type("#password", "secret_sauce") | ||
sb.click('input[type="submit"]') | ||
sb.highlight("div.inventory_list", loops=6) | ||
sb.save_cookies(name="cookies.txt") | ||
|
||
# Load previously saved cookies to bypass login | ||
with SB(test=True) as sb: | ||
sb.open("https://www.saucedemo.com") | ||
sb.load_cookies(name="cookies.txt") | ||
sb.open("https://www.saucedemo.com/inventory.html") | ||
sb.highlight("div.inventory_list", loops=12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters