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

**URL:** <https://forum.robotframework.org/t/error-on-keyword-take-screenshot-using-robotframework-browser-16-0-0/5356>\
**Category:** Browser\
**Created:** [23 February 2023 23:22 UTC](https://forum.robotframework.org/t/error-on-keyword-take-screenshot-using-robotframework-browser-16-0-0/5356 "2023-02-23T23:22:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joaoMoreira](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@joaoMoreira](https://forum.robotframework.org/u/joaoMoreira)\
**Post date:** [23 February 2023 23:22 UTC](https://forum.robotframework.org/t/error-on-keyword-take-screenshot-using-robotframework-browser-16-0-0/5356/1 "2023-02-23T23:22:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [24 February 2023 07:26 UTC](https://forum.robotframework.org/t/error-on-keyword-take-screenshot-using-robotframework-browser-16-0-0/5356/2 "2023-02-24T07:26:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PaulusBrand](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@PaulusBrand](https://forum.robotframework.org/u/PaulusBrand)\
**Post date:** [27 February 2023 13:57 UTC](https://forum.robotframework.org/t/error-on-keyword-take-screenshot-using-robotframework-browser-16-0-0/5356/3 "2023-02-27T13:57:07Z")

</div>

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