Comments (6)
Actually, i think you can reproduce it if you open chrome dev tools in the browser (ctrl+shift+j).
from chromote.
I can reproduce this when multiple clients are attached (which isn't supported by the protocol). Are you using Chromote and the browser at the same time?
from chromote.
The simplest way to reproduce the issue is this:
- Close all opened browsers and start a single chrome browser with the remote-debugging-port parameter:
chrome.exe -remote-debugging-port=9222
-
In that browser, open chrome dev tools (ctrl+shift+j)
-
Run the next code:
from chromote import Chromote
chrome = Chromote()
tab = chrome.tabs[0]
At this point the exception should appear
yield ChromeTab(tab['title'], tab['url'], tab['webSocketDebuggerUrl'])
If you close the chrome dev tools and run again the snippet the exception won't be launched.
Btw, cool project of yours!
from chromote.
It's not real solution but locally I've patched _get_tabs:
def _get_tabs(self):
"""
Get all open browser tabs that are pages tabs
"""
res = requests.get(self.url + '/json')
for tab in res.json():
if ('webSocketDebuggerUrl' in tab.keys()):
if tab['type'] == 'page':
yield ChromeTab(tab['title'], tab['url'], tab['webSocketDebuggerUrl'])
So i can use chromote having multiple browsers where many tabs will be using the ChromeDevTools... I won't get them back of course but at least Chromote won't crash.
from chromote.
Great, why not send a PR. My preference would be to drop the parens and explicate call to keys
:
if 'webSocketDebuggerUrl' in tab:
from chromote.
Nah, your choice, it's your baby ;-)
For my use-case i've tweaked my local copy like this:
def _get_tabs(self):
res = requests.get(self.url + '/json')
for tab in res.json():
if tab['type'] == 'page':
if ('webSocketDebuggerUrl' not in tab.keys()):
yield ChromeTab(tab['title'], tab['url'], None)
else:
yield ChromeTab(tab['title'], tab['url'], tab['webSocketDebuggerUrl'])
and adding one method to check "valid" tabs:
def is_valid(self):
return self._websocket_url is not None
That way i have all available tabs from my browsers, if i want to reload one tab i just check first if is valid or not, it works wonderfully... That way i can run my scripts while other tabs have opened the chrome-dev-tools, workflow is fast.
from chromote.
Related Issues (11)
- cannot use chrome.tabs HOT 2
- Post request use chromote HOT 1
- Documentation? HOT 3
- Add new version number to current code HOT 1
- Chrome wont start with debugging
- how to make mouseclicks on ajax pages?
- LICENSE file HOT 2
- in `_send`, should `Runtime.evaluate` take `"returnByValue": False`? HOT 1
- Using chromote for multiple Chrome processes with different debugger ports? HOT 1
- How do we get the contents of the page from the tab? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chromote.