-
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.
Merge pull request #2257 from seleniumbase/some-improvements
Some improvements
- Loading branch information
Showing
28 changed files
with
270 additions
and
60 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
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,37 @@ | ||
from seleniumbase import SB | ||
|
||
|
||
def click_turnstile_and_verify(sb): | ||
sb.driver.reconnect(0.1) | ||
iframe = sb.driver.find_element("iframe") | ||
sb.driver.reconnect(0.5) | ||
sb.driver.switch_to.frame(iframe) | ||
sb.driver.uc_click("span.mark") | ||
sb.highlight("img#captcha-success", timeout=3.33) | ||
|
||
|
||
with SB(uc=True, test=True) as sb: | ||
sb.driver.uc_open_with_reconnect( | ||
"https://seleniumbase.io/apps/form_turnstile", | ||
reconnect_time=2.33, | ||
) | ||
try: | ||
click_turnstile_and_verify(sb) | ||
except Exception: | ||
sb.driver.uc_open_with_reconnect( | ||
"https://seleniumbase.io/apps/form_turnstile", | ||
reconnect_time=2.33, | ||
) | ||
click_turnstile_and_verify(sb) | ||
sb.press_keys("#name", "SeleniumBase") | ||
sb.press_keys("#email", "test@test.test") | ||
sb.press_keys("#phone", "1-555-555-5555") | ||
sb.click('[for="date"]') | ||
sb.click("td.is-today button") | ||
sb.click('div[class="select-wrapper"] input') | ||
sb.click('span:contains("9:00 PM")') | ||
sb.highlight_click('input[value="AR"] + span') | ||
sb.click('input[value="cc"] + span') | ||
sb.highlight_click('button:contains("Request & Pay")') | ||
sb.highlight("img#submit-success") | ||
sb.highlight('button:contains("Success!")') |
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,16 @@ | ||
from seleniumbase import SB | ||
|
||
with SB(uc=True, test=True) as sb: | ||
sb.driver.uc_open_with_reconnect( | ||
"https://seleniumbase.io/apps/turnstile", | ||
reconnect_time=2.33, | ||
) | ||
sb.driver.reconnect(0.1) | ||
iframe = sb.driver.find_element("iframe") | ||
sb.driver.reconnect(0.5) | ||
sb.driver.switch_to.frame(iframe) | ||
sb.driver.uc_click("span.mark") | ||
sb.switch_to_default_content() | ||
sb.assert_element("img#captcha-success", timeout=3.33) | ||
sb.set_messenger_theme(location="top_left") | ||
sb.post_message("Selenium wasn't detected!", duration=3) |
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,28 @@ | ||
from seleniumbase import BaseCase | ||
BaseCase.main(__name__, __file__) | ||
|
||
|
||
class CDPNetworkBlockingTests(BaseCase): | ||
def test_cdp_network_blocking(self): | ||
if not self.is_chromium: | ||
self.skip("This test is only for Chromium browsers!") | ||
self.execute_cdp_cmd( | ||
'Network.setBlockedURLs', {"urls": [ | ||
"*googlesyndication.com*", | ||
"*doubleclick.net*", | ||
"*adsafeprotected.com*", | ||
"*2mdn.net*", | ||
"*googletagmanager.com*", | ||
"*adsafeprotected.com*", | ||
"*snigelweb.com*", | ||
"*fastclick.net*", | ||
"*amazon-adsystem.com*", | ||
"*google-analytics.com*", | ||
]}) | ||
self.execute_cdp_cmd('Network.enable', {}) | ||
self.open('https://www.w3schools.com/jquery/default.asp') | ||
source = self.get_page_source() | ||
self.assert_true("doubleclick.net" not in source) | ||
self.assert_true("google-analytics.com" not in source) | ||
if self.demo_mode: | ||
self.post_message("Blocking was successful!") |
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
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
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
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# seleniumbase package | ||
__version__ = "4.20.9" | ||
__version__ = "4.21.0" |
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
Oops, something went wrong.