Skip to content

Commit 0754c5a

Browse files
authored
[py][bidi]: use bidi navigate command in network tests (#16251)
1 parent 5d281ef commit 0754c5a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

py/test/selenium/webdriver/common/bidi_network_tests.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
import pytest
1918

19+
from selenium.webdriver.common.bidi.browsing_context import ReadinessState
2020
from selenium.webdriver.common.bidi.network import Request
2121
from selenium.webdriver.common.by import By
2222

@@ -68,29 +68,26 @@ def callback(request: Request):
6868
assert driver.find_element(By.NAME, "login").is_displayed(), "Request not continued"
6969

7070

71-
@pytest.mark.xfail_chrome
72-
@pytest.mark.xfail_edge
7371
def test_continue_request(driver, pages):
7472
def callback(request: Request):
7573
request.continue_request()
7674

7775
callback_id = driver.network.add_request_handler("before_request", callback)
7876
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)
8079
assert driver.find_element(By.NAME, "login").is_displayed(), "Request not continued"
8180

8281

83-
@pytest.mark.xfail_chrome
84-
@pytest.mark.xfail_edge
8582
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")
8784
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+
)
8988
assert "authenticated" in driver.page_source, "Authorization failed"
9089

9190

92-
@pytest.mark.xfail_chrome
93-
@pytest.mark.xfail_edge
9491
def test_remove_auth_handler(driver):
9592
callback_id = driver.network.add_auth_handler("user", "passwd")
9693
assert callback_id is not None, "Request handler not added"

0 commit comments

Comments
 (0)