|
15 | 15 | # specific language governing permissions and limitations |
16 | 16 | # under the License. |
17 | 17 |
|
18 | | -import pytest |
19 | 18 |
|
| 19 | +from selenium.webdriver.common.bidi.browsing_context import ReadinessState |
20 | 20 | from selenium.webdriver.common.bidi.network import Request |
21 | 21 | from selenium.webdriver.common.by import By |
22 | 22 |
|
@@ -68,29 +68,26 @@ def callback(request: Request): |
68 | 68 | assert driver.find_element(By.NAME, "login").is_displayed(), "Request not continued" |
69 | 69 |
|
70 | 70 |
|
71 | | -@pytest.mark.xfail_chrome |
72 | | -@pytest.mark.xfail_edge |
73 | 71 | def test_continue_request(driver, pages): |
74 | 72 | def callback(request: Request): |
75 | 73 | request.continue_request() |
76 | 74 |
|
77 | 75 | callback_id = driver.network.add_request_handler("before_request", callback) |
78 | 76 | assert callback_id is not None, "Request handler not added" |
79 | | - pages.load("formPage.html") |
| 77 | + url = pages.url("formPage.html") |
| 78 | + driver.browsing_context.navigate(context=driver.current_window_handle, url=url, wait=ReadinessState.COMPLETE) |
80 | 79 | assert driver.find_element(By.NAME, "login").is_displayed(), "Request not continued" |
81 | 80 |
|
82 | 81 |
|
83 | | -@pytest.mark.xfail_chrome |
84 | | -@pytest.mark.xfail_edge |
85 | 82 | def test_continue_with_auth(driver): |
86 | | - callback_id = driver.network.add_auth_handler("user", "passwd") |
| 83 | + callback_id = driver.network.add_auth_handler("postman", "password") |
87 | 84 | assert callback_id is not None, "Request handler not added" |
88 | | - driver.get("https://httpbin.org/basic-auth/user/passwd") |
| 85 | + driver.browsing_context.navigate( |
| 86 | + context=driver.current_window_handle, url="https://postman-echo.com/basic-auth", wait=ReadinessState.COMPLETE |
| 87 | + ) |
89 | 88 | assert "authenticated" in driver.page_source, "Authorization failed" |
90 | 89 |
|
91 | 90 |
|
92 | | -@pytest.mark.xfail_chrome |
93 | | -@pytest.mark.xfail_edge |
94 | 91 | def test_remove_auth_handler(driver): |
95 | 92 | callback_id = driver.network.add_auth_handler("user", "passwd") |
96 | 93 | assert callback_id is not None, "Request handler not added" |
|
0 commit comments