title: Grid concept in Selenium
body: <p>I have written coding for browser opening with grid concept. I wrote the following code. I need to know its correct or wrong.</p>
  
  <pre><code>properties
  ----------
  HUB=localhost
  PORT=4444
  Browser = chrome
  Url=http://demo.guru99.com/v4/index.php
  
  Code
  ----
  package processor;
  
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.util.Properties;
  
  import org.openqa.selenium.Platform;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.firefox.FirefoxDriver;
  import org.openqa.selenium.ie.InternetExplorerDriver;
  import org.openqa.selenium.remote.DesiredCapabilities;
  import org.openqa.selenium.remote.RemoteWebDriver;
  
  public class Browser {
  
      public static void main(String[] args) throws FileNotFoundException, IOException {
  
          RemoteWebDriver driver;
          Properties prop;
          prop = new Properties();
          prop.load(new FileInputStream("./config.properties"));
  
          String hub = prop.getProperty("HUB");
          String port = prop.getProperty("PORT");
          String browser = prop.getProperty("Browser");
          String url = prop.getProperty("Url");
  
  
          if (browser.equalsIgnoreCase("chrome") || browser.equalsIgnoreCase("ie")
                  || browser.equalsIgnoreCase("firefox")) {
  
  
  
              if (browser.equalsIgnoreCase("chrome")) {
                  try {
                      DesiredCapabilities dc;
                      dc = new DesiredCapabilities();
                      dc.setBrowserName(browser);
                      dc.setPlatform(Platform.WINDOWS);
                      System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
                      driver = new ChromeDriver();
                      System.out.println("Chrome Browser is Initialising..........");
                      driver.manage().window().maximize();
                      driver.get(url);
                  } catch (Exception e) {
                      System.out.println("Problem Occurred while Initialising Chrome Browser. Check for the Driver Name &amp; Path !!!!!!!!!!");
                  }
              }
  
              if (browser.equalsIgnoreCase("ie")) {
                  try {
                      DesiredCapabilities dc;
                      dc = new DesiredCapabilities();
                      dc.setBrowserName(browser);
                      dc.setPlatform(Platform.WINDOWS);
                      System.setProperty("webdriver.ie.driver", "./Drivers/IEDriverServer.exe");
                      driver = new InternetExplorerDriver();
                      System.out.println("Internet Explorer is Initialising..........");
                      driver.manage().window().maximize();
                      driver.get(url);
                  } catch (Exception e) {
                      System.out.println("Problem Occurred while Initialising Internet Explorer. Check for the Driver Name &amp; Path !!!!!!!!!!");
                  }
              }
  
              if (browser.equalsIgnoreCase("firefox")) {
                  try {
                      DesiredCapabilities dc;
                      dc = new DesiredCapabilities();
                      dc.setBrowserName(browser);
                      dc.setPlatform(Platform.WINDOWS);
                      driver = new FirefoxDriver();
                      System.out.println("Firefox is Initialising..........");
                      driver.manage().window().maximize();
                      driver.get(url);
                  } catch (Exception e) {
                      System.out.println("Problem Occurred while Initialising Firefox. Check for the Driver Name &amp; Path !!!!!!!!!!");
                  }
              }
          } 
  
          else {
              System.out.println("Invalid Browser. Check Browser Name in Properties File.......... ");
          }       
      }
  }
  </code></pre>
  
  <p>Kindly see the code and tell me the correct code. Grid Concept i need to apply.</p>