I am writing a program in Selenium, but getting error like below
WebDriverManager.chromedriver().setup; "The method setup() is undefined for the type Object.
How to define setup() in WebDriverManager.chromedriver
! could you please help me out on this.
I downloaded WebDriverManager
and Chromedriver
and I added in pom.xml
dependency.
But still getting error on
WebdriverManager.chromedriver().setup();
WebDriverManager.chromedriver()
working fine.
When I entered WebdriverManager.chromedriver().setup();
then its showing error. .
Edit: Below is the code snippet package org.h2k.openmrs.tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeClass;
import io.github.bonigarcia.wdm.WebDriverManager;
public class BaseClassExample {
protected WebDriver driver;
@BeforeClass
public void instantiateDriver()
{
WebDriverManager.chromedriver().setup();
driver= new ChromeDriver();
driver.get("https://demo.openmrs.org/openmrs/login.htm");
String title = driver.getTitle();
System.out.println("Title of the page:::" + title);
}
}
Try to use
.create()
like:Then: