eclipse – Getting Exception in thread “main”java.lang.Error

This error message…

Exception in thread "main" java.lang.Error: Unresolved compilation problem: Invalid escape sequence (valid ones are \b \t \n \f \r " ' \ )

…implies that there was a compilation error in the escape sequence while interpreting the ChromeDriver absolute path.

Using Java while mentioning the system paths you need to escape the \ character for the compiler to understand the path.


Solution

You need to escape all the \ characters, effectively replace all the \ with \\. So the line of code:

System.setProperty("webdriver.chrome.driver", "C:\Users\91888\Downloads\chromedriver_win32.exe");

needs to be:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\91888\\Downloads\\chromedriver_win32.exe");

Read more here: Source link