Junit - Single Run Program

package default;

import java.net.URL;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class Sample { 
  private WebDriver driver; 

  @Before
  public void setUp() throws Exception { 
    DesiredCapabilities capability = DesiredCapabilities.chrome();
    driver = new RemoteWebDriver(new URL("<Application URL>"),capability);
  } 

  @Test 
  public void testSample() throws Exception { 
    driver.get("http://www.google.com");
    WebElement element = driver.findElement(By.name("q"));
    element.sendKeys("Selenium Junit");
    element.submit(); 
    System.out.println("Page title is: " + driver.getTitle());


  } 

  @After
  public void tearDown() throws Exception { 
      driver.quit(); 
  } 
}  

Popular posts from this blog

Selenium Webdriver Interview Questions with Answer

Selenium IDE Interview Questions with Answer

DLL to Jar file conversion