enter code here
import java.util.ArrayList;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ArrayLiist {
public static void main(String[] args) {
launchBrowser("CH");
WebDriver driver=null;
driver.findElement(By.id("user_login")).sendKeys("admin");
driver.findElement(By.id("user_pss")).sendKeys("demo123");
driver.findElement(By.id("wp-submit")).click();
}
public static void launchBrowser(String bn) {
if(bn=="CH")
{
System.setProperty("webdriver.chrome.driver","E:\\Selenium Downloaded\\chrome\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("http://demosite.center/wordpress/wp-admin/plugins.php");
}
}
}
i think driver is not being identified ? i have institiated webdriver =null , still it is showing null pointer exception
Exception in thread "main" java.lang.NullPointerException at ArrayLiist.main(ArrayLiist.java:13)