So I am trying to open a chrome browser in incognito mode and then do a few more things beyond that with selenium.
Here is the code and I am using selenium 4.8.1
package com.bocc.mavenbocc;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class Application {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "assets/drivers/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("incognito");
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com");
}
}
so first off I get the following:
Error: Unable to initialize main class com.bocc.mavenbocc.Application Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
So then I found that you need to define the dependencies so I placed this in the pom.xml file
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
but this still results in the same error.
what am I missing.