擅长:python、mysql、java
<p>这是不可能的。来自<a href="https://sites.google.com/a/chromium.org/chromedriver/help/devtools-window-keeps-closing" rel="nofollow noreferrer">ChromeDriver help center</a></p>
<blockquote>
<p>When you open the DevTools window, ChromeDriver is automatically
disconnected. When ChromeDriver receives a command, if disconnected,
it will attempt to close the DevTools window and reconnect.</p>
<p>If you need to inspect something in DevTools, the best you can do now
is pause your test so that ChromeDriver won't close DevTools. When you
are done inspecting things in Chrome, you can unpause your test and
ChromeDriver will close the window and continue.</p>
</blockquote>