-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
This is my small code that submits the login form of the localhost environment but when I run this program I am receiving the exception. I have no idea why i am receiving these kinds of errors. Can anyone please check it from your end?
def login_identifier():
request_monitor= []
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=False)
page = browser.new_page()
page.on('request', lambda request: request_monitor.append({request.method:[request.url, request.post_data, request.header_value("Content-type")]}))
print("Browsing -> ", "https://localhost/")
page.goto("https://localhost/")
page.locator('input[name="login"]').fill('test@test.com')
page.locator('input[name="password"]').fill('Test12!@')
page.locator('div[id="signIn"]').click()
print("Successfully Submitted the form")
browser.close()
print("Login Identifier Complete")
print(request_monitor, "aaaaa")
Exceptions I am getting is -
Exception in callback SyncBase._sync.<locals>.<lambda>(<Task cancell...twork.py:231>>) at C:\python\lib\site-packages\playwright\_impl\_sync_base.py:100
handle: <Handle SyncBase._sync.<locals>.<lambda>(<Task cancell...twork.py:231>>) at C:\python\lib\site-packages\playwright\_impl\_sync_base.py:100>
Traceback (most recent call last):
File "C:\python\lib\site-packages\playwright\_impl\_network.py", line 232, in header_value
return (await self._actual_headers()).get(name)
File "C:\python\lib\site-packages\playwright\_impl\_network.py", line 240, in _actual_headers
headers = await self._channel.send("rawRequestHeaders")
File "C:\python\lib\site-packages\playwright\_impl\_connection.py", line 44, in send
return await self._connection.wrap_api_call(
File "C:\python\lib\site-packages\playwright\_impl\_connection.py", line 419, in wrap_api_call
return await cb()
File "C:\python\lib\site-packages\playwright\_impl\_connection.py", line 70, in inner_send
done, _ = await asyncio.wait(
File "C:\python\lib\asyncio\tasks.py", line 413, in wait
return await _wait(fs, timeout, return_when, loop)
File "C:\python\lib\asyncio\tasks.py", line 525, in _wait
await waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\python\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\python\lib\site-packages\playwright\_impl\_sync_base.py", line 100, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
File "C:\python\lib\site-packages\playwright\_impl\_browser_context.py", line 132, in <lambda>
lambda params: self._on_request(
File "C:\python\lib\site-packages\playwright\_impl\_browser_context.py", line 483, in _on_request
page.emit(Page.Events.Request, request)
File "C:\python\lib\site-packages\pyee\base.py", line 176, in emit
handled = self._call_handlers(event, args, kwargs)
File "C:\python\lib\site-packages\pyee\base.py", line 154, in _call_handlers
self._emit_run(f, args, kwargs)
File "C:\python\lib\site-packages\pyee\asyncio.py", line 48, in _emit_run
coro: Any = f(*args, **kwargs)
File "C:\python\lib\site-packages\playwright\_impl\_impl_to_api_mapping.py", line 123, in wrapper_func
return handler(
File "C:\Users\shubh\testing\authbypass\case3\python3_scripts\tests\route3.py", line 47, in <lambda>
page.on('request', lambda request: request_monitor.append({request.method:[request.url, request.post_data, request.header_value("Content-type")]}))
File "C:\python\lib\site-packages\playwright\sync_api\_generated.py", line 382, in header_value
self._sync(self._impl_obj.header_value(name=name))
File "C:\python\lib\site-packages\playwright\_impl\_sync_base.py", line 104, in _sync
return task.result()
asyncio.exceptions.CancelledError
Exception in callback SyncBase._sync.<locals>.<lambda>(<Task cancell...twork.py:231>>) at C:\python\lib\site-packages\playwright\_impl\_sync_base.py:100
handle: <Handle SyncBase._sync.<locals>.<lambda>(<Task cancell...twork.py:231>>) at C:\python\lib\site-packages\playwright\_impl\_sync_base.py:100>
Traceback (most recent call last):
File "C:\python\lib\site-packages\playwright\_impl\_network.py", line 232, in header_value
return (await self._actual_headers()).get(name)
File "C:\python\lib\site-packages\playwright\_impl\_network.py", line 240, in _actual_headers
headers = await self._channel.send("rawRequestHeaders")
File "C:\python\lib\site-packages\playwright\_impl\_connection.py", line 44, in send
return await self._connection.wrap_api_call(
File "C:\python\lib\site-packages\playwright\_impl\_connection.py", line 419, in wrap_api_call
return await cb()
File "C:\python\lib\site-packages\playwright\_impl\_connection.py", line 70, in inner_send
done, _ = await asyncio.wait(
File "C:\python\lib\asyncio\tasks.py", line 413, in wait
return await _wait(fs, timeout, return_when, loop)
File "C:\python\lib\asyncio\tasks.py", line 525, in _wait
await waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\python\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\python\lib\site-packages\playwright\_impl\_sync_base.py", line 100, in <lambda>
task.add_done_callback(lambda _: g_self.switch())
File "C:\python\lib\site-packages\playwright\_impl\_browser_context.py", line 132, in <lambda>
lambda params: self._on_request(
File "C:\python\lib\site-packages\playwright\_impl\_browser_context.py", line 483, in _on_request
page.emit(Page.Events.Request, request)
File "C:\python\lib\site-packages\pyee\base.py", line 176, in emit
handled = self._call_handlers(event, args, kwargs)
File "C:\python\lib\site-packages\pyee\base.py", line 154, in _call_handlers
self._emit_run(f, args, kwargs)
File "C:\python\lib\site-packages\pyee\asyncio.py", line 48, in _emit_run
coro: Any = f(*args, **kwargs)
File "C:\python\lib\site-packages\playwright\_impl\_impl_to_api_mapping.py", line 123, in wrapper_func
return handler(
File "C:\Users\shubh\testing\authbypass\case3\python3_scripts\tests\route3.py", line 47, in <lambda>
page.on('request', lambda request: request_monitor.append({request.method:[request.url, request.post_data, request.header_value("Content-type")]}))
File "C:\python\lib\site-packages\playwright\sync_api\_generated.py", line 382, in header_value
self._sync(self._impl_obj.header_value(name=name))
File "C:\python\lib\site-packages\playwright\_impl\_sync_base.py", line 104, in _sync
return task.result()
asyncio.exceptions.CancelledError
Can anyone show me a way to come out from this?
Metadata
Metadata
Assignees
Labels
No labels