I'm trying to log into a website with HtmlUnitDriver and I keep getting a java.lang.error.
Ive added multiple jars to fix my com.gargoylesoftware.htmlunit.browserversion error which fixed that but caused another problem.
import org.jsoup.Connection;
import org.jsoup.Connection.Response;
import org.jsoup.Connection.Method;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import java.io.IOException;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.HasInputDevices;
public class selenium
public static void main ( String[] args ) throws IOException {
HtmlUnitDriver driver = new HtmlUnitDriver(true); // line that shows a error
String baseUrl = "website";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(baseUrl);
driver.findElement(By.name("username")).clear();
driver.findElement(By.name("username")).sendKeys("username");
driver.findElement(By.name("password")).clear();
driver.findElement(By.name("password")).sendKeys("password");
driver.findElement(By.cssSelector("input[type='submit']")).click();
Exception in thread "main" java.lang.Error: Unresolved compilation problems: HtmlUnitDriver cannot be resolved to a type HtmlUnitDriver cannot be resolved to a type Syntax error, insert "}" to complete ClassBody