简体   繁体   中英

Is there any dummy project test cases for webdrive selenium in java?

I am a beginner in Selenium WebDrive. Is there any dummy projects or testcases that could help me start learning? Could you please suggest some starting points?

You can just use a dummy class as shown below..

import static org.junit.Assert.fail;

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TestExample {
  private WebDriver driver;
  private String baseUrl;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://localhost:8080";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testExample() throws Exception {
    driver.get(baseUrl);
  }

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

And just make sure you have the Selenium maven repo in your pom with junit.

You can start with the following

Getting Started Guide

documentation

more examples

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM