chromote
chromote copied to clipboard
cannot use chrome.tabs
Hey, thanks for making this repo. I tried to run but I'm running into an issue:
>>> from chromote import Chromote
>>> chrome = Chromote()
>>> chrome
Chromote(host="localhost", port=9222)
>>> print chrome
According to readme, I should see the following:
[Chromote(tabs=1)]
But instead, I see this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/chromote/__init__.py", line 156, in __str__
return '[Chromote(tabs=%d)]' % len(self)
File "/usr/local/lib/python3.6/site-packages/chromote/__init__.py", line 153, in __len__
return len(self.tabs)
File "/usr/local/lib/python3.6/site-packages/chromote/__init__.py", line 150, in tabs
return tuple(self._get_tabs())
File "/usr/local/lib/python3.6/site-packages/chromote/__init__.py", line 132, in _get_tabs
for tab in res.json():
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 886, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Tried this in python 2.7 and got the same result as well.
Any ideas????
Thanks!
Hey, do you have the developer tools open in chrome at the same time as running chromote?
Hi, no not at all, in fact I was using this to connect to headless chrome. Is that the problem?