arsenic icon indicating copy to clipboard operation
arsenic copied to clipboard

Dict in get_screenshot method

Open FRiMN opened this issue 3 years ago • 3 comments

When I try to call method Session.get_screenshot():

python_1  |   File "/usr/local/lib/python3.7/site-packages/arsenic/session.py", line 300, in get_screenshot
python_1  |     base64.b64decode(await self._request(url="/screenshot", method="GET"))
python_1  |   File "/usr/local/lib/python3.7/base64.py", line 80, in b64decode
python_1  |     s = _bytes_from_decode_data(s)
python_1  |   File "/usr/local/lib/python3.7/base64.py", line 46, in _bytes_from_decode_data
python_1  |     "string, not %r" % s.__class__.__name__) from None
python_1  | TypeError: argument should be a bytes-like object or ASCII string, not 'dict'

I guess it is dict in data returned from RequestHelpers.connection.request().

Response is:

{
    "message": "invalid session id\n  (Driver info: chromedriver=73.0.3683.75,platform=Linux 5.4.0-65-generic x86_64)"
}

FRiMN avatar Mar 27 '21 19:03 FRiMN

That's not good 😆

dimaqq avatar Mar 29 '21 05:03 dimaqq

@FRiMN could you provide a MRE?

I was not able to reproduce, I've tried the newest versions:

  • ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})
  • arsenic==20.9
  • aiohttp==3.7.4.post0

I've added xx = await driver.get_screenshot() to a random existing test that uses arsenic and that produced a valid io.BytesIO with sane length.

dimaqq avatar Mar 29 '21 06:03 dimaqq

I'm considering to close this...

dimaqq avatar Jun 16 '21 02:06 dimaqq