I tried to create GUI for the selenium web driver project with JavaFX, but when I run this code on eclipse with java 8 I got this error. I'm expecting that after I click the button then the chrome is launched and run the test case. Here's my code :
FXML File :
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane prefHeight="200.0" prefWidth="200.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.SampleController">
   <center>
      <Button fx:id="primary" mnemonicParsing="false" onAction="#seleniumLaunch" text="Button" BorderPane.alignment="CENTER" />
   </center>
</BorderPane>
Controller class:
In this button function I expect after I click on it then chrome browser launch and then go to baseURL
package application;
import java.net.URL;
import java.util.ResourceBundle;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import selenium.TestCase;
public class SampleController implements Initializable {
TestCase testcase = new TestCase();
    @FXML
    private Button primary;
    @FXML
    void seleniumLaunch() {
            System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\driver\\chromedriver.exe");
            WebDriver driver = new ChromeDriver();
        
            String baseUrl = "http://demo.guru99.com/test/newtours/";
            driver.get(baseUrl);
    }
    @Override // and this
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }    
}
Error log :
Exception in Application start method
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 27 more
Exception running application application.Main
