Actually from the picture everything is clear. Help guys to open several browsers at the touch of a button. For manipulations I use library Selenium. Here, for example, the opening code 1 browser.

private void button1_Click(object sender, EventArgs e) { IWebDriver Browser = new ChromeDriver(); Browser.Manage().Window.Maximize(); } 

This way you can open 2:

  private void button1_Click(object sender, EventArgs e) { IWebDriver Browser = new ChromeDriver(); Browser.Manage().Window.Maximize(); IWebDriver Browser2 = new ChromeDriver(); Browser2.Manage().Window.Maximize(); } 

It is necessary either through the array or through the cycle or else add the number of openings, but nothing comes to mind.

Open multiple browsers

    1 answer 1

    I myself thought of =) Here is the code:

      private void button1_Click(object sender, EventArgs e) { Count(); } public void Count() { for (int i = 0; i < numericUpDown1.Value; i++) { IWebDriver br = null; Open(br); } } public void Open (IWebDriver browser) { browser = new ChromeDriver(); browser.Manage().Window.Maximize(); } 
    • 1) It is better to call the methods more understandable words. 2) It is not clear why creating IWebDriver br in a loop. You can make. 3) In general, why do you pass null as a parameter? It could be created in the Open method. - Trymount