Comments (2)
I found the solution. First of all, the fact that my program "stalled" in my terminal is not a problem - it simply means that the chrome process is ongoing. in order to resolve this apparent issue, which is more like a preference, I elected to open a different terminal, but I could have used:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=remote-profile&
The ampersand causes the program to run in the background.
Secondly, I had a problem executing:
>>> import PyChromeDevTools
>>> chrome = PyChromeDevTools.ChromeInterface()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/PyChromeDevTools-0.1-py3.6.egg/PyChromeDevTools/__init__.py", line 43, in __init__
File "/usr/local/lib/python3.6/site-packages/PyChromeDevTools-0.1-py3.6.egg/PyChromeDevTools/__init__.py", line 54, in connect
AttributeError: module 'websocket' has no attribute 'create_connection'
The cause of this error is that I had installed the wrong dependency with pip. Running "pip3 list" (I have two separate pip installations, one for python2.7 and one for python3, with symlinks pip and pip3 accordingly; if you only have python3 and use only one installation of pip, you're fine, don't worry about this) I got:
Package Version
---------------- ---------
certifi 2018.4.16
chardet 3.0.4
cycler 0.10.0
gevent 1.3.4
greenlet 0.4.13
idna 2.7
kiwisolver 1.0.1
numpy 1.14.1
pip 10.0.1
PyChromeDevTools 0.1
pyparsing 2.2.0
python-dateutil 2.7.0
requests 2.19.1
setuptools 38.5.2
six 1.11.0
urllib3 1.23
**websocket 0.2.1
websocket-client 0.48.0**
wheel 0.30.0
I uninstalled websocket
then installed websocket-client
, with this result:
(3rdPartyInstagramApp) MacBook-Pro:~ forestdewberry$ sudo -H pip3 uninstall websocket
Uninstalling websocket-0.2.1:
Would remove:
/usr/local/lib/python3.6/site-packages/websocket-0.2.1.dist-info/*
/usr/local/lib/python3.6/site-packages/websocket/*
Proceed (y/n)? y
Successfully uninstalled websocket-0.2.1
(3rdPartyInstagramApp) MacBook-Pro:~ forestdewberry$ sudo -H pip3 install websocket-client
Requirement already satisfied: websocket-client in /usr/local/lib/python3.6/site-packages/websocket_client-0.48.0-py3.6.egg (0.48.0)
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from websocket-client) (1.11.0)
(3rdPartyInstagramApp) MacBook-Pro:~ forestdewberry$ sudo -H pip3 uninstall websocket-client
Uninstalling websocket-client-0.48.0:
Would remove:
/usr/local/lib/python3.6/site-packages/websocket_client-0.48.0-py3.6.egg
Proceed (y/n)? y
Successfully uninstalled websocket-client-0.48.0
(3rdPartyInstagramApp) MacBook-Pro:~ forestdewberry$ sudo -H pip3 install websocket-client
Collecting websocket-client
Downloading https://files.pythonhosted.org/packages/8a/a1/72ef9aa26cfe1a75cee09fc1957e4723add9de098c15719416a1ee89386b/websocket_client-0.48.0-py2.py3-none-any.whl (198kB)
100% |████████████████████████████████| 204kB 1.4MB/s
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from websocket-client) (1.11.0)
Installing collected packages: websocket-client
Successfully installed websocket-client-0.48.0
(3rdPartyInstagramApp) MacBook-Pro:~ forestdewberry$ python3
Python 3.6.4 (default, Mar 9 2018, 23:15:08)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyChromeDevTools
>>> chrome = PyChromeDevTools.ChromeInterface()
>>>
It works!
from pychromedevtools.
Perfect;)
from pychromedevtools.
Related Issues (20)
- Can it drive multiple Chrome at the same time? HOT 2
- Is it possible to get websocket data? HOT 1
- targetID?
- If I want to fetch real-time http or https traffic HOT 2
- How to get the HTML source code? Thanks HOT 4
- Browser.close() does not work
- setGeolocationOverride
- Catch Ajax Request HOT 2
- websocket._exceptions.WebSocketConnectionClosedException: socket is already closed. HOT 8
- Get logs of AdBlock Plugins
- I think the example to measure time to load is wrong HOT 1
- In the case of network.enable, when the webpage has a looped video, pop_messages will enter an endless loop
- ModuleNotFoundError: No module named 'PyChromeDevTools' HOT 1
- How to do Page.javascriptDialogOpening?
- How to use it to interact with Chrome console using .py file?
- WebSocketBadStatusException: Handshake status 403 Forbidden when connecting to >= WebView 111.0.5563.58 HOT 1
- PyChromeDevTools.ChromeInterface() return decoder error
- Some questions about --remote-allow-origins and how I solved it HOT 1
- Can it work with chromedriver and selenium? 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 pychromedevtools.