Skip to content

Commit 9fff934

Browse files
committed
Revert to my previos code
1 parent e975af2 commit 9fff934

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import pytest
2-
from selenium.common import TimeoutException
32
from selenium.webdriver import Firefox
4-
from selenium.webdriver.support import expected_conditions as EC
53
from selenium.webdriver.support.wait import WebDriverWait
64

75
HTTP_URL = "http://example.com"
@@ -23,15 +21,8 @@ def test_https_first_mode_in_private_browsing(driver: Firefox):
2321
# Navigate to the HTTP URL
2422
driver.get(HTTP_URL)
2523

26-
try:
27-
# Wait for the URL to be redirected to HTTPS
28-
WebDriverWait(driver, 10).until(EC.url_contains("https://example.com/"))
29-
except TimeoutException:
30-
pytest.fail(
31-
f"Timed out waiting for URL to switch to HTTPS: {driver.current_url}"
32-
)
33-
34-
# Assertion to ensure URL starts with HTTPS
35-
assert driver.current_url.startswith(
36-
"https://"
37-
), f"Final URL should be 'https://example.com/', but was: {driver.current_url}"
24+
# Wait for the URL to be redirected to HTTPS
25+
assert WebDriverWait(driver, 10).until(
26+
lambda d: d.current_url.startswith("https://"),
27+
message=f"Final URL should use HTTPS, but was: {driver.current_url}",
28+
)

0 commit comments

Comments
 (0)