Error on Keyword 'Take Screenshot' using robotframework-browser==16.0.0

I’m receiving an error when I try to take a screenshot on Firefox 109 or Webkit 16.0 using the robotframework-browser 16.0.0. The error don’t happened on Chromiun 110.

Keyword ‘Take Screenshot fail-screenshot-{index}’ could not be run on failure:
SyntaxError: page.screenshot: Unexpected token u in JSON at position 0

Using the version 13.1.0 the error not happened.

Traceback (most recent call last):
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/Browser/playwright.py”, line 149, in grpc_channel
yield playwright_pb2_grpc.PlaywrightStub(self._channel)
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/Browser/keywords/browser_control.py”, line 161, in take_screenshot
response = stub.TakeScreenshot(
^^^^^^^^^^^^^^^^^^^^
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/grpc/_channel.py”, line 946, in call
return _end_unary_response_blocking(state, call, False, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/grpc/_channel.py”, line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.RESOURCE_EXHAUSTED
details = “SyntaxError: page.screenshot: Unexpected token u in JSON at position 0
=========================== logs ===========================
taking page screenshot
============================================================”
debug_error_string = “UNKNOWN:Error received from peer ipv4:xxxxxx:XXXXXX {created_time:“xxxxxx”, grpc_status:8, grpc_message:“SyntaxError: page.screenshot: Unexpected token u in JSON at position 0\n=========================== logs ===========================\ntaking page screenshot\n============================================================”}”

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/Browser/browser.py”, line 1063, in run_keyword
raise e
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/Browser/browser.py”, line 1052, in run_keyword
return DynamicCore.run_keyword(self, name, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/robotlibcore.py”, line 122, in run_keyword
return self.keywords[name](*args, **(kwargs or {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/Browser/keywords/browser_control.py”, line 134, in take_screenshot
with self.playwright.grpc_channel() as stub:
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/contextlib.py”, line 155, in exit
self.gen.throw(typ, value, traceback)
File “/Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/Browser/playwright.py”, line 153, in grpc_channel
raise AssertionError(error.details())
AssertionError: SyntaxError: page.screenshot: Unexpected token u in JSON at position 0

That is a known bug in Playwright. I think we will make a new release this weekend to fix that, because playwright also just released a new version.

2 Likes

I’m also running into this one. I’ll retest when the new browser library version comes out.