Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions py/test/selenium/webdriver/common/bidi_network_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.

import pytest

from selenium.webdriver.common.bidi.browsing_context import ReadinessState
from selenium.webdriver.common.bidi.network import Request
from selenium.webdriver.common.by import By

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


@pytest.mark.xfail_chrome
@pytest.mark.xfail_edge
def test_continue_request(driver, pages):
def callback(request: Request):
request.continue_request()

callback_id = driver.network.add_request_handler("before_request", callback)
assert callback_id is not None, "Request handler not added"
pages.load("formPage.html")
url = pages.url("formPage.html")
driver.browsing_context.navigate(context=driver.current_window_handle, url=url, wait=ReadinessState.COMPLETE)
assert driver.find_element(By.NAME, "login").is_displayed(), "Request not continued"


@pytest.mark.xfail_chrome
@pytest.mark.xfail_edge
def test_continue_with_auth(driver):
callback_id = driver.network.add_auth_handler("user", "passwd")
callback_id = driver.network.add_auth_handler("postman", "password")
assert callback_id is not None, "Request handler not added"
driver.get("https://httpbin.org/basic-auth/user/passwd")
driver.browsing_context.navigate(
context=driver.current_window_handle, url="https://postman-echo.com/basic-auth", wait=ReadinessState.COMPLETE
)
assert "authenticated" in driver.page_source, "Authorization failed"


@pytest.mark.xfail_chrome
@pytest.mark.xfail_edge
def test_remove_auth_handler(driver):
callback_id = driver.network.add_auth_handler("user", "passwd")
assert callback_id is not None, "Request handler not added"
Expand Down
Loading