Using Selenium,a beginner here,I was using system.setProperty to set the path for .exe file from local directory but its giving error,although I know now after selenium 4.5 selenium manager does the work to download .exe file internally,but i was just curious and changed my selenium dependency version to 4.0.0,downloaded the chromedriver.exe file from CFT dashboard,and extracted it,gave the path but i am getting a syntax error which i dont know why its throwing the syntax error-“Syntax error on token “)”, delete this token”,everything seems fine to me,any help would be appreciated,thanks.
import org.openqa.selenium.chrome.ChromeDriver;
public class WebDriverBasics {
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver","C:\Users\rookie\Documents\MyDriver\chromedriver.exe");
ChromeDriver driver=new ChromeDriver(); //4.23.0
//EdgeDriver driver=new EdgeDriver();
driver.get("https://www.google.com");
String title=driver.getTitle();
if(title.equalsIgnoreCase("google"))
{
System.out.println("Correct Title....Pass");
}
else
{
System.out.println("Incorrect Title....Fail");
}
driver.quit();
}
}
I couldnt get forward due to syntax error
-Syntax error on token “)”, delete this token
Razer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.