Selenium Framework Design in Data-Driven Testing
上QQ阅读APP看书,第一时间看更新

The class signature

The class should be named something obvious such as Driver.java, CreateDriver.java, SeleniumDriver.java, and so on. Since this will be a Java singleton class, it will contain a private constructor and a static getInstance method as follows:

/**
* Selenium Singleton Class
*
* @author CarlCocchiaro
*
*/
@SuppressWarnings("varargs")
public class CreateDriver {

// constructor
private CreateDriver() {
}

/**
* getInstance method to retrieve active driver instance
*
* @return CreateDriver
*/
public static CreateDriver getInstance() {
if ( instance == null ) {
instance = new CreateDriver();
}

return
instance;
}
}