如何在多个远程调试端口上打开多个google-chrome?
打开 chrome 将 selenium 连接到现有的 chrome 会话
我通过使用"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\ selenum\ChromeProfile"
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
chrome_options.add_argument('--headless')
chrome_options.add_argument('--remote-debugging-port=9222') # Recommended is 9222
chrome_driver = "Data/chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
我正在做一个项目,我必须在 chrome 的不同端口上打开多个 chrome 窗口。因此,我希望在端口 9222 和端口 9223 上打开另一个实例,
但是当我执行
“C:\Program Files\Google\Chrome\Application\chrome.exe”时 --remote-debugging-port=9223 --user-data- dir="C:\selenum\ChromeProfile"
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9223")
chrome_options.add_argument('--headless')
chrome_options.add_argument('--remote-debugging-port=9223') # Recommended is 9222
chrome_driver = "Data/chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
它响应为
Opening in existing browser session.
这意味着它不是在不同端口上而是在同一端口上打开该会话。我想控制谷歌浏览器的第二个实例,而不是第一个已经打开的实例。
如何避免这种情况并在不同端口上打开多个 google chrome 实例?
I connect selenium to an existing chrome session by opening chrome with
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\selenum\ChromeProfile"
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
chrome_options.add_argument('--headless')
chrome_options.add_argument('--remote-debugging-port=9222') # Recommended is 9222
chrome_driver = "Data/chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
I am doing a project where I would have to open multiple windows of chrome on different ports for chrome. So I am looking to open another instance on port 9222 and port 9223
but when I do
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9223 --user-data-dir="C:\selenum\ChromeProfile"
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9223")
chrome_options.add_argument('--headless')
chrome_options.add_argument('--remote-debugging-port=9223') # Recommended is 9222
chrome_driver = "Data/chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
It responds with
Opening in existing browser session.
Which means it's not opening that session on a different port but on the same one. I want to control the second instance of google chrome, not the first already opened.
How can I avoid this and open multiple google chrome instances on different ports?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用最新版本的Chrome,我正在使用(104.0.5112.102)
创建一些空文件夹,例如C:\ Selenum \ 9222 C:\ Selenum \ 9223(Windows System)
上次设置快捷方式路径,如下面的
快捷方式,您会看到结果
“ C:\ Program Files \ Google \ Chrome \ Chrome \ Application \ Chrome.exe” - remote-debugging-port = 9123 -user-data-data-dir = c:\ selenum \ 9222
” c:\ program files \ google \ google \ chrome \ application \ chrome.exe“ - remote-debugging-port = 9123 -user-data-dir = c:\ selenum \ 9223
Use the latest version of Chrome, I'm using(104.0.5112.102)
create some empty folders like C:\selenum\9222 C:\selenum\9223 (Windows system)
last set shortcuts path like below
run shortcuts,and you will see the result
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9123 --user-data-dir=C:\selenum\9222
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9123 --user-data-dir=C:\selenum\9223
使用Chrome Portable(S)或Chrome+Chrome Portable
different users on the same windows same computer
different computers.
边缘和铬
Haven't found any way to do this with two instances of chrome.
use Chrome portable (s) or chrome+chrome portable
different users on the same windows same computer
different computers.
Edge and Chrome
Haven't found any way to do this with two instances of chrome.