Chrome controller for Humans, based on Chrome Devtools Protocol(CDP) and python3.7+.
Chrome controller for Humans, base on Chrome Devtools Protocol(CDP) and python3.7+. Read Docs
If you encounter any problems, please let me know through issues, some of them will be a good opinion for the enhancement of
ichrome
.
pip install ichrome -U
Uninstall & Clear the user data folder
$ python3 -m ichrome --clean
$ pip uninstall ichrome
import asyncio
from ichrome import AsyncChromeDaemon
async def test():
async with AsyncChromeDaemon() as cd:
# create a new tab
async with cd.connect_tab(index=None) as tab:
await tab.goto('https://github.com/ClericPy/ichrome', timeout=5)
print(await tab.title)
# Privacy Mode, proxyServer arg maybe not work on Chrome, for `Target.createBrowserContext` is the EXPERIMENTAL feature(but chromium is ok).
# https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createBrowserContext
async with cd.incognito_tab(proxyServer='http://127.0.0.1:8080') as tab:
await tab.goto('https://httpbin.org/ip', timeout=5)
print(await tab.html)
asyncio.run(test())
ichrome
includes fast http & websocket connections (based on aiohttp) within an asyncio environmentasyncio
) supportsync
and async
usage
puppeteer
joined it.As we known,
Javascript
is the first-class citizen of the Browser world, so learn to use it withichrome
frequently.
async
environment compatiblewebsocket
Incognito Mode
ChromeEngine
as the progress pool
api
router with FastAPI (EXPERIMENTAL)
python -m ichrome.web
python -m ichrome.web --help
for usageFlatten
mode with sessionId
Websocket
connection and use sessionId
to distinguish requestsAsyncTab._DEFAULT_FLATTEN = True
ichrome.debugger
>4.0.0 (EXPERIMENTAL)