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

0 votes
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 in Java by anonymous

edited Jul 26 by Omkar 89 views

1 answer to this question.

0 votes

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 by Venu

Related Questions In Java

0 votes
2 answers

When I am running eclispe on my computer it is throwing error. How to resolve it?

If you have downloaded the 64 bit ...READ MORE

answered Dec 10, 2018 in Java by Sushmita
• 6,880 points
94 views
0 votes
2 answers

How can we display an output of float data with 2 decimal places in java? Please help

Use String.format()  if you need the value as ...READ MORE

answered Aug 26 in Java by Sirajul
• 30,140 points
48 views
0 votes
1 answer

How can we convert Strings to and from UTF8 byte arrays?

To convert STring to byte[]: String s = ...READ MORE

answered Jun 21, 2018 in Java by Akrati
• 3,150 points
31 views
0 votes
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,540 points
66 views
0 votes
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,280 points
53 views
0 votes
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,320 points
466 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,190 points
441 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
• 67,620 points
342 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,190 points
75 views