我想在沒有主要方法的類中創建webdriver對象引用。它不允許我創建對象。最後,我想用一個實例,它是不工作(不識別驅動器)無法創建webdriver對象引用
public class LoginPage
{
public static WebDriver driver;
static ResourceLoader loader = new ResourceLoader();
public static String loginVerify(String username, String password)
{
System.out.println("navigated to loginvarify() :: ");
logger.info("username is "+username);
logger.info("password is "+password);
try
{
driver.findElement(By.id(loader.getProperty(Constants.UserName))).sendKeys(username);
}
請幫我
Selenium Version,Browser Type&Version please。 – DebanjanB
selenium 53.0,FF 39.0 –
你在哪裏實例化'公共靜態WebDriver驅動程序;'? –