Skip to content

Commit a166557

Browse files
committed
added remove_auth_handler, all tests passing
1 parent 5b75c6d commit a166557

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

py/selenium/webdriver/common/bidi/network.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,16 @@ def _callback(request):
255255

256256
return self.add_request_handler(event, _callback)
257257

258+
def remove_auth_handler(self, callback_id):
259+
"""Remove an authentication handler from the network.
260+
261+
Parameters:
262+
----------
263+
callback_id (int): The callback id to remove.
264+
"""
265+
event = "auth_required"
266+
self.remove_request_handler(event, callback_id)
267+
258268

259269
class Request:
260270
"""Represents an intercepted network request."""

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,13 @@ def test_continue_with_auth(driver):
9797
assert callback_id is not None, "Request handler not added"
9898
driver.get("https://httpbin.org/basic-auth/user/passwd")
9999
assert "authenticated" in driver.page_source, "Authorization failed"
100+
101+
102+
@pytest.mark.xfail_chrome
103+
@pytest.mark.xfail_edge
104+
@pytest.mark.xfail_safari
105+
def test_remove_auth_handler(driver):
106+
callback_id = driver.network.add_auth_handler("user", "passwd")
107+
assert callback_id is not None, "Request handler not added"
108+
driver.network.remove_auth_handler(callback_id)
109+
assert driver.network.intercepts == [], "Intercept not removed"

0 commit comments

Comments
 (0)