简体   繁体   English

通过selenium webdriver启动后,Chrome浏览器会立即终止

[英]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.

相关问题 硒版本更改为3.13.0后,Chrome浏览器无法启动 - chrome browser not getting launched after changing selenium version to 3.13.0 谷歌浏览器在启动后立即关闭 selenium - Google chrome closes immediately after being launched with selenium 查找 Selenium WebDriver 启动的浏览器进程的 PID - Find PID of browser process launched by Selenium WebDriver 在Windows 7 32位上使用Selenium-Webdriver打开Chrome浏览器后出现错误 - Getting error after opening Chrome browser using Selenium-Webdriver on Windows 7 32 bit 在Ruby中提取由Selenium WebDriver发布的浏览器的pid - Extract pid of browser launched by Selenium WebDriver in Ruby 使用Selenium通过cygwin在Python中使用ChromeDriver和Chrome浏览器下载csv文件后,出现路径失败的错误 - Failed-Path Too Long error after downloading csv file using ChromeDriver and Chrome Browser launched by Selenium through cygwin in Python 浏览器未在Python中使用Selenium启动 - Browser not getting launched with Selenium in Python 如何设置Selenium WebDriver在隐身/私有模式下启动的Chrome和Opera浏览器窗口大小? - How to set browser window size for Chrome and Opera launched by Selenium WebDriver in incognito/private mode? Chrome 浏览器未通过 Selenium 调用 - Chrome browser not getting invoked through Selenium 从 selenium 加载后 Chrome 浏览器立即关闭 - Chrome browser closes immediately after loading from selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM