Tuesday, May 16, 2023

Two Chrome windows using Selenium

 To open two Chrome windows using Selenium, you can use the following code in Python:


```python

from selenium import webdriver


# create first instance of Chrome

chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument("--start-maximized")

driver1 = webdriver.Chrome(options=chrome_options)


# create second instance of Chrome

chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument("--start-maximized")

driver2 = webdriver.Chrome(options=chrome_options)

```


This code will create two instances of Chrome, each running with its own `WebDriver` object. The `--start-maximized` argument maximizes the window when it is launched. You can modify the options to suit your specific needs.


Note

0 comments:

Post a Comment