from DrissionPage import Chromium, ChromiumOptions
co = ChromiumOptions()
# co.incognito()
# 本地已经打开的浏览器端口号
# 你也可以不显式制定端口,其默认连接的就是9222端口
co.set_local_port(9222)
browser = Chromium(co)
# browser.clear_cache()
browser.set.auto_handle_alert()
# 标签页操作
tab = browser.latest_tab
# Windows 示例
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\temp\chrome_profile"
# macOS 示例
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir="/tmp/chrome_profile"
# Linux 示例
google-chrome --remote-debugging-port=9222 --user-data-dir="/tmp/chrome_profile"
Top comments (0)