I'm changing my selenium porject from 3.141 to 4.7.0 but i'm seeing NoSuchElementException on PageFactory Initialization.
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.7.1</version>
</dependency>
public WebElementsLogin(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(this.driver, this);
}
java.lang.NoSuchMethodError: 'void org.openqa.selenium.support.PageFactory.initElements(org.openqa.selenium.SearchContext, java.lang.Object)'
Using selenium 4.7.1 and JDK 11:
Everything works as expected.
Correct this line: