Answer the question
In order to leave comments, you need to log in
Setting a variable to be an object?
Example:
var tmp;
if(true or false){
tmp = new FirefoxDriver();
} else {
tmp = new ChromeDriver();
}
Answer the question
In order to leave comments, you need to log in
To tell you the data type, or what? The simplest is Object. The most correct is the base type for both Drivers that inherit from it.
IMHO, it will be more correct to use interfaces
IDriver driver;
if (true or false)
{
driver = new FirefoxDriver();
}
else
{
driver = new ChromeDriver();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question