pychrome icon indicating copy to clipboard operation
pychrome copied to clipboard

Something broken with newest chrome with tabs managment

Open gzivdo opened this issue 6 years ago • 2 comments

Running example multi_tabs_navigate.py gives error:


Traceback (most recent call last):
  File "./2.py", line 97, in <module>
    main()
  File "./2.py", line 70, in main
    close_all_tabs(browser)
  File "./2.py", line 64, in close_all_tabs
    assert len(browser.list_tab()) == 0
AssertionError

If i comment assert statement I get antother error:

Traceback (most recent call last):
  File "./2.py", line 97, in <module>
    main()
  File "./2.py", line 74, in main
    tabs.append(browser.new_tab())
  File "/usr/local/lib/python2.7/dist-packages/pychrome/browser.py", line 28, in new_tab
    tab = Tab(**rp.json())
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Last one just after calling new_tab()

gzivdo avatar Jun 02 '18 11:06 gzivdo

Were you ever able to figure out how to fix this?

kimsbrian avatar Apr 01 '19 16:04 kimsbrian

I had the same issue when I was trying to use headless chrome in docker (image: https://hub.docker.com/r/chromedp/headless-shell). I was referring to the chrome debug endpoint with hostname (docker service name). When I used the IP address instead of the hostname, the issue was solved.

callkalpa avatar Nov 10 '19 00:11 callkalpa