title: Can AWS EC2 be used for running automated Selenium tests on a remote location
body: <p>At work we are running automated Selenium tests on a remote location (BrowserStack). This is how the remote web driver is instantiated and these tests also use <code>testNG</code> and the way the project is set up is that each test passes a row number into this <code>DriverInit</code> constructor and will then tests things that are on that row (that part isn't shown in the code). The problem is we don't have the money to run 100 parallel tests on BrowserStack and we are all unfamiliar with this.</p>
  <p>After reading, it seems like AWS ec2 would be a good option but I have no idea how it works even after watching videos on it. Does ec2 have the capability of taking a project like this and running a testNG suite? What is the easiest way to do this? We don't need any of the fancy stuff that BrowserStack or SaucyLabs has. We simply need to run browser tests in the background, but we do not need to have a video recording or any testing information. We really just need the CPU power to run a lot of parallel tests remotely.</p>
  <p>Ideally we would like to be able to just replace the <code>URL</code> with another url and run tests like that if possible.</p>
  <pre><code>public class DriverInit{
  
         public WebDriver driver;
         public ChromeOptions chromeOptions;
         public DesiredCapabilities caps;
  
         public static final String USERNAME = &quot;my_name&quot;;
         public static final String AUTOMATE_KEY = &quot;blah_blah_blah&quot;;
         public static final String URL = &quot;https://&quot; + USERNAME + &quot;:&quot; + AUTOMATE_KEY + &quot;@hub-cloud.browserstack.com/wd/hub&quot;;
         
          DriverInit(int row) throws MalformedURLException {
  
              // for BrowserStack testing
                 caps = new DesiredCapabilities();
                 caps.setCapability(&quot;os&quot;, &quot;Windows&quot;);
                 caps.setCapability(&quot;os_version&quot;, &quot;10&quot;);
                 caps.setCapability(&quot;browser&quot;, &quot;Chrome&quot;);
                 caps.setCapability(&quot;browser_version&quot;, &quot;80.0 beta&quot;);
                 caps.setCapability(&quot;browserstack.local&quot;, &quot;false&quot;);
                 caps.setCapability(&quot;browserstack.selenium_version&quot;, &quot;3.5.2&quot;);
  
                 caps.setCapability(&quot;name&quot;, &quot;selenium test for row &quot; + row);
                 this.driver = new RemoteWebDriver(new URL(URL), caps);
                 this.chromeOptions = new ChromeOptions();
  
                 String chromeDriverPath = &quot;resources/chromedriver.exe&quot;;
                 System.setProperty(&quot;webdriver.chrome.driver&quot;, chromeDriverPath); 
          }
  </code></pre>