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

Class variables

Initially, when building the class, there will be various private and public variables used that should be declared at the top of the class. This organizes the variables into one place in the file, but of course, this is a coding style guideline. Some of the common variables required to start are as follows:

public class CreateDriver {
// local variables
private static CreateDriver instance = null;
private String browserHandle = null;
private static final int IMPLICIT_TIMEOUT = 0;

private
ThreadLocal<WebDriver> webDriver =
new ThreadLocal<WebDriver>();

private
ThreadLocal<AppiumDriver<MobileElement>> mobileDriver =
new ThreadLocal<AppiumDriver<MobileElement>>();

private
ThreadLocal<String> sessionId =
new ThreadLocal<String>();

private
ThreadLocal<String> sessionBrowser =
new ThreadLocal<String>();

private
ThreadLocal<String> sessionPlatform =
new ThreadLocal<String>();

private
ThreadLocal<String> sessionVersion =
new ThreadLocal<String>();

private
String getEnv = null;
}