Issue
I need to use below code to login to webpage using Java
Cannot resolve symbol 'HtmlPage'
error with below code
final WebClient webClient = new WebClient();
final HtmlPage page1 = webClient.getPage("https://www.valueresearchonline.com/login");
final HtmlTextInput textField = form.getInputByName("email");
textField.setValueAttribute("[email protected]");
For WebClient
added below dependancy in pom.xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<version>5.3.22</version>
</dependency>
But not getting what other dependancies to be added for HtmlPage
?
Solution
I think you got the wrong depency. You need:
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.64.0</version>
</dependency>
You also should remove webflux and potentially generated imports.
Answered By - DrHopfen
Answer Checked By - Senaida (JavaFixing Volunteer)