How to create a chrome window again after closing the chrome window with webdriver.close() in Python selenium Question

Asked 2 years ago, Updated 2 years ago, 35 views

When you run driver = webdriver.chrome(),

Chrome driver executable (?) window (dos-like window on a black screen) and Chrome browser window

It's on the screen together.

Since then, only the Chrome browser window has been closed with the close() method.

The chrome driver window is still on the screen.

Is there any way to open a new chrome browser window with the driver?

Do I have to run the poem webdriver.chrome() again to create a Chrome browser window?

python selenium

2022-09-21 19:40

1 Answers

The difference between close and quit is that close only closes the tab. Quit, on the other hand, shuts down (resources off) the driver.

The close only state is that the driver is still valid, so you can create a new tab.

You can use a script that opens one window, as shown below.

driver.execute_script("window.open();")


2022-09-21 19:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.