I am trying to get my head around spring boot and I am having some issues trying to integrate selenium into my spring boot application. I am trying to achieve a simple web page, which has a input box and button. The input box will contain a URL and the button will then launch a selenium browser navigating to that URL entered.
I currently have a simple spring boot application consisting of the following:
index.html
Contains an input form (user types URL here) which is passed to myController.
myController.java
@Controller
public class myController {
@Autowired
private WebDriver driver;
....
}
pom.xml
Contains selenium..
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
My error when I run my project:
APPLICATION FAILED TO START
Description:
Field driver in com.project.myController required a bean of type 'org.openqa.selenium.WebDriver' that could not be found.
Action:
Consider defining a bean of type 'org.openqa.selenium.WebDriver' in your configuration.
I am trying to create an instance of Selenium WebDriver so that I can use it whenever I need to. I will only ever need it in this controller, so I declared it here. What am I missing? Any help will be appreciated. Thank you in advance.