I was asked in an interview whether Selenium Webdriver supported parameterized constructors.
Example:
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Cons {
public String username="u";
public String pswd="p";
public String baseurl="url";
public WebDriver d;
public Cons(String username, String pswd){
d = new FirefoxDriver();
d.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
d.get(baseurl);
d.findElement(By.name("username")).sendKeys(this.username);
d.findElement(By.name("pwd")).sendKeys(this.pswd);
}
}