Google Chrome 不想启动并给出错误消息

问题描述 投票:0回答:1

我正在尝试从我的 Linux 控制台运行 google chrome,但我遇到了这个阻止我的错误

[1210/075921.073808:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No 
such file or directory (2)
[1210/075921.074075:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No 
such file or directory (2)
Trace/breakpoint trap (core dumped)

我正在尝试启动它,因为当我启动我的 Selenium shell 文件时,我收到此错误:

org.openqa.selenium.SessionNotCreatedException: Could not start a new
 session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assu
ming that Chrome has crashed.)

我需要降级我的 google chrome 版本吗?

版本

谷歌浏览器 V 96

ChromeDriver V 96 我下载了 linux chromedriver

我的 chrome 启动代码:

@BeforeTest
    public void LaunchWebsite() throws IOException {
        File ScreenShots = new File(System.getProperty("user.dir") + "/" + "test-output/ScreenShots");
        if(ScreenShots.mkdir()) {
            System.out.println("The File Screen shot was created successfully");
        }
        // Launch Chrome
        String path = System.getProperty("user.dir");
        //System.setProperty("webdriver.chrome.driver", path+"/Driver/chromedriver.exe");
        System.setProperty("webdriver.chrome.driver", path+"/Driver/chromedriver");
        driver = new ChromeDriver();
        // Acces Website
        driver.get("");
        driver.manage().window().maximize();
        Base b = new Base(driver);
        Reporter.log(FormatMessageSucces + " Chrome is Opened</font>");
    }
linux selenium google-chrome selenium-chromedriver
1个回答
0
投票

你说你“……没有解释为什么运行 Chrome sudo 作为我自己的用户帐户会修复这些启动崩溃……”

请记住,sudo 生成的 shell 中活动的环境变量集不一定与“正常”登录中的环境变量集相同。因此,也许尝试将 -E 选项添加到 sudo 命令中,看看行为是否发生变化...

© www.soinside.com 2019 - 2024. All rights reserved.