5

iam running a selenium script and keep on getting the above error. here is the code:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class WhatsappTest {

    public static void main(String[] args) {

        System.setProperty("webdriver.chrome.driver", "C:\\Users\\PC-Name\\Documents\\selenium jars\\chromedriver_win32\\chromedriver.exe");

        ChromeOptions options = new ChromeOptions();
        options.addArguments("user-data-dir=C:\\Users\\PC-Name\\AppData\\Local\\Google\\Chrome\\User Data");
//      options.addArguments("--no-sandbox");
//        options.addArguments("--disable-dev-shm-usage");

        WebDriver driver = new ChromeDriver(options);

        //Puts an Implicit wait, Will wait for 10 seconds before throwing exception
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        //Maximize the browser
        driver.manage().window().maximize();
        //Launch website
        driver.navigate().to("https://www.facebook.com/");
        System.out.println(driver.getTitle());

        driver.close();
    }

}

So the commented line in the code have not worked for me. I am getting this error always when I am adding this line:

options.addArguments("user-data-dir=C:\\Users\\Manish\\AppData\\Local\\Google\\Chrome\\User Data");

and code working fine without adding the above line.

here is more about the error:

(unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)

System Info: Windows 7 SP-1 64-bit

Chrome Info: Version 71.0.3578.98 (Official Build) (64-bit)

Java Version: 10.0.1

Please help me with this.

2
  • 1
    @DebanjanB none of the solution from that thread is working for me. Have already checked and then posted this question. So can you please remove the duplicate mark or if possible, please help me with this error. Commented Dec 14, 2018 at 4:42
  • Can you update the question to demonstrate how this question is different from the dup marked question? Here most of us are developers and want to keep DRY. See: How do I do X? Commented Dec 14, 2018 at 7:12

1 Answer 1

0

Your path is invalid...most likely because of the space. Try this instead:

options.addArguments("user-data- 
dir=C:\\Users\\Manish\\AppData\\Local\\Google\\Chrome\\User_Data");

If that doesn't work there are other markers that have been used to replace a space.

Sign up to request clarification or add additional context in comments.

3 Comments

Here is a good example: askubuntu.com/questions/530578/…
i think this is not the problem the code is accepting the file location and opening a chrome instance with my existing setting but after that code is getting crashed
try to give \\ at the end, code is working fine in my system. Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.