[英]Chrome Browser terminates immediately after getting launched through selenium webdriver
I have installed the following versions to use selenium with chrome. 我已安装以下版本以将硒与铬一起使用。 The chrome browser is getting launched and opens the required url but immediately gets terminated and the window closes within few secs. chrome浏览器启动并打开所需的url,但立即终止,并在几秒钟内关闭窗口。 Please guide me on any changes I need to do. 请指导我进行任何必要的更改。
Versions: Chrome:78.0.3904.108 Chrome Driver:78.0.3904.105 Selenium:selenium-java-3.141.59 Java:jdk-8u231-windows-x64 版本: Chrome:78.0.3904.108 Chrome驱动程序:78.0.3904.105 Selenium:selenium-java-3.141.59 Java:jdk-8u231-windows-x64
Code: 码:
System.setProperty("webdriver.chrome.driver","C:\\Users\\Pooja\\Desktop\\ChromeDriver\\chromedriver.exe);
WebDriver driver = new ChromeDriver();
driver.get("https://selenium.dev");
System.out.println(driver.getTitle());
driver.quit();
Output in console after execution: 执行后在控制台中输出:
Starting ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}) on port 1226 Only local connections are allowed. 在端口1226上启动ChromeDriver 78.0.3904.105(60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs / branch-heads / 3904 @ {#877})仅允许本地连接。 Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. 请保护ChromeDriver和相关测试框架使用的端口,以防止恶意代码访问。 [1574867082.995][WARNING]: Timed out connecting to Chrome, retrying... Nov 27, 2019 10:04:45 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C SeleniumHQ Browser Automation [1574867082.995] [警告]:连接到Chrome时超时,正在重试... 2019年11月27日上午10:04:45 org.openqa.selenium.remote.ProtocolHandshake createSession INFO:检测到方言:W3C SeleniumHQ浏览器自动化
I tried this using the same versions of Google chrome and the Chrome driver and it works for me. 我使用相同版本的Google chrome和Chrome驱动程序尝试了此操作,并且对我有用。 The issue is that you missed a quotation mark at then end of your driver path. 问题是您在驱动程序路径的末尾错过了引号 。
Hope this helps 希望这可以帮助
System.setProperty("webdriver.chrome.driver","C:\\Users\\edgar\\Downloads\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://selenium.dev");
System.out.println(driver.getTitle());
driver.quit();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.