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.