Facing Unresolved compilation problem Invalid escape sequence valid ones are b t n f r error when trying to launch firefox from selenium Can anyone please help me

+1 vote
package firstseleniumproject;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class openbrowser {

public static void main(String[] args) {

System.setProperty("webdriver.gecko.driver", "C:\Users\KSaraswathiChowdary\Documents\softwares\geckodriver-v0.24.0-win64.exe");

WebDriver driver = new FirefoxDriver();

driver.get("http://www.google.com");

}

}
Jul 26, 2019 in Java by anonymous

edited Jul 26, 2019 by Omkar 4,414 views

1 answer to this question.

+1 vote

I think the problem is with this line:

System.setProperty("webdriver.gecko.driver", "C:\Users\KSaraswathiChowdary\Documents\softwares\geckodriver-v0.24.0-win64.exe");

Backslashes (\) are used for escape sequence. Try this:

System.setProperty("webdriver.gecko.driver", "C:\\Users\\KSaraswathiChowdary\\Documents\\softwares\\geckodriver-v0.24.0-win64.exe");
answered Jul 26, 2019 by Venu
Problem is not resolved with is this line
"Facing error path does not exist"
System.setProperty("webdriver.gecko.driver", "C:\\Users\\KSaraswathiChowdary\\Documents\\softwares\\geckodriver-v0.24.0-win64.exe");

In essence, the error is telling you that somewhere, you have a backslash that does not belong, and it's escaping a character that is not in the list it's shown you.

Try using a valid escape sequence such as a backslash character.

Alternatively, you should use forward slashes, those are filesystem independent and will work whether you run your Java program on Windows, Mac, Linux or elsewhere. 

"D:/workbox/Online Store/geckodriver.exe"

Related Questions In Java

0 votes
1 answer

Can anyone help me i have been struggling for weeks now to solve this problem

Hello, @Tafadzwa, Any way just navigate to C:\Users\user.gradle\caches\ ...READ MORE

answered Dec 24, 2020 in Java by Gitika
• 65,770 points
2,376 views
+1 vote
0 answers

getting below error when trying to conver csv file to json :The method readerFor(Class<Map>) is undefined for the type CsvMapper

PFB source code: import java.io.File; import java.lang.*; import java.util.Arrays; import java.util.List; import ...READ MORE

Dec 29, 2019 in Java by anonymous
• 160 points

closed Jan 14, 2020 by Kalgi 2,105 views
+1 vote
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,620 points
1,361 views
+1 vote
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

answered Jun 26, 2018 in Java by scarlett
• 1,290 points
1,217 views
+1 vote
1 answer

Performance difference of if/else vs switch statement in Java

The thing you are worried about is ...READ MORE

answered Jul 26, 2018 in Java by geek.erkami
• 2,680 points
3,781 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,220 points
3,646 views
0 votes
1 answer

Getting error 404 not found when trying to download JDK

Try this command, it should work: wget --no-check-certificate ...READ MORE

answered Dec 26, 2018 in Java by Omkar
• 69,220 points
3,383 views
0 votes
2 answers

How can I Copy files from one directory to another in Java

Java 8 Path sourcepath = Paths.get("C:\\data\\temp\\mydir"); ...READ MORE

answered Aug 10, 2018 in Java by samarth295
• 2,220 points
4,457 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP