Skip to content

Commit 4b44735

Browse files
authored
nonlocalized request_id
1 parent 86ad50e commit 4b44735

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ def add_request_handler(self, callback, url_pattern=''):
116116
str: The request ID of the intercepted response.
117117
"""
118118
self.__add_intercept(phases=[self.PHASES['before_request']])
119+
request_id = None
119120
def callback_on_url_match(data):
121+
nonlocal request_id
120122
if url_pattern in data['request']['url']:
121123
# create request object to pass to callback
122124
request_id = data['request'].get('requestId', None)
@@ -156,8 +158,10 @@ def add_response_handler(self, callback, url_pattern=''):
156158
str: The request ID of the intercepted response.
157159
"""
158160
self.__add_intercept(phases=[self.PHASES['response_started']])
161+
request_id = None
159162
def callback_on_url_match(data):
160163
# create response object to pass to callback
164+
nonlocal request_id
161165
if url_pattern in data['response']['url']:
162166
request_id = data['request'].get('requestId', None)
163167
url = data['response'].get('url')

0 commit comments

Comments
 (0)