【问题标题】:/opt/chromeos/chromedriver: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /opt/chromeos/chromedriver) using chromium browser on linux/opt/chromeos/chromedriver: /lib64/libc.so.6: 在 Linux 上使用 chromium 浏览器未找到版本“GLIBC_2.15”(/opt/chromeos/chromedriver 需要)
【发布时间】:2023-03-05 00:00:01
【问题描述】:

我正在尝试在 linux 中使用 chromium 浏览器运行 selenium 测试用例 ..

在 linux 中设置 chromium 浏览器的步骤:

从以下路径下载 chrome-linux.zip 并解压到 linux 机器的某个特定路径中

https://storage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/572137/chrome-linux.zip

将最新的chromedriver linux版本文件(2.40)放入linux机器

已授予 chromedrive 文件以及 chrome-linux 文件夹的完全权限 (777)。

还有硒代码:

WebDriver driver =  null;
DesiredCapabilities caps =  DesiredCapabilities.chrome();
ChromeOptions opts = new ChromeOptions();
opts.addArguments("--headless");
opts.addArguments("--disable-extensions");
opts.setBinary("/opt/chromeos/chrome-linux/chrome");//path of the chrome application file in linux 
caps.setCapability(ChromeOptions.CAPABILITY, opts);
System.setProperty("webdriver.chrome.driver", "/opt/chromeos/chomedriver");//path of the chromedriver file in linux
driver = new ChromeDriver(caps);
driver.get("https://www.google.com/");

当我尝试运行时,出现无法访问的浏览器异常。

/opt/chromeos/chromedriver: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /opt/chromeos/chromedriver)
/opt/chromeos/chromedriver: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/chromeos/chromedriver)
/opt/chromeos/chromedriver: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /opt/chromeos/chromedriver)
Jul 03, 2018 12:46:53 PM org.openqa.selenium.os.UnixProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'ION-MUM-PreQA-JB-61-75', ip: '10.10.61.75', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-696.el6.x86_64', java.version: '1.7.0_101'
Driver info: driver.version: ChromeDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)
        at com.DemoChromiumTest.main(DemoChromiumTest.java:24)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'ION-MUM-PreQA-JB-61-75', ip: '10.10.61.75', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-696.el6.x86_64', java.version: '1.7.0_101'
Driver info: driver.version: ChromeDriver
        at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:178)
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
        ... 6 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:16689/status] to be available after 20012 ms
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
        at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:175)
        ... 9 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
        at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
        ... 10 more
Caused by: java.util.concurrent.TimeoutException
        at java.util.concurrent.FutureTask.get(FutureTask.java:201)
        at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
        ... 11 more

任何建议或指导将不胜感激...

【问题讨论】:

    标签: java linux selenium selenium-chromedriver chromium


    【解决方案1】:

    此错误消息...

    /opt/chromeos/chromedriver: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /opt/chromeos/chromedriver)
    /opt/chromeos/chromedriver: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/chromeos/chromedriver)
    /opt/chromeos/chromedriver: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /opt/chromeos/chromedriver)
    Jul 03, 2018 12:46:53 PM org.openqa.selenium.os.UnixProcess checkForError
    SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    

    ...暗示 ChromeDriver 由于缺少 而无法启动/生成新的 WebBrowserChrome 浏览器 会话GLIBC_2.15 和/或 GLIBC_2.14

    首先,根据您在使用Selenium Java Client v2.53.0时的问题详细信息,我认为您的代码块没有任何问题。但是,由于您使用的是 Linux OS 而不是 chrome-linux.zip,因此您必须确保下载了 chrome-linux.tar / chrome-linux.tz 并将其解压缩以正确使用。


    出了什么问题

    /lib64/libc.so.6: version 'GLIBC_2.15' not found/lib64/libc.so.6: version 'GLIBC_2.14' not found

    您尝试执行的 ChromeDriver 二进制文件是在基于 GLIBC-2.15 的系统上构建的,不会在任何具有旧 GLIBC 的系统上执行。

    /usr/lib64/libstdc++.so.6: version 'GLIBCXX_3.4.15' not found

    同样,您尝试执行的 ChromeDriver 二进制文件是在基于 GLIBCXX_3.4.15 的系统上构建的,它不会在任何具有旧 GLIBC 的系统上执行,因为您的 GLIBC 早于 2.14。


    tl;博士

    查看DistroWatch.com 以获取兼容的二进制文件。


    可能的解决方案

    此外,您还没有提到您的确切环境细节,这里还有一些可能的原因和解决方案:

    • 根据Error on running chromedriver in CentOS 6.6,如果您使用版本7以下的CentOS,升级到CentOS version 7将解决您的问题。
    • 根据chromedriver_linux64_2.1.zip not working in CentOS 6.4 (latest),您需要:

      • 为 CentOS6.4 下载最新的 chrome (http://chrome.richardlloyd.org.uk/)
      • 下载最新的 ChromeDriver (2.40) 。
      • 现在转到/opt/google/chrome 文件夹(您需要sudo 访问权限)。
      • chromedriver复制到这个文件夹(这是为了简单起见,你可以在任何地方拥有它)。
      • google-chrome 的副本创建为google-chromedriver。 vi google-chromedriver 和最后一行修改为:

         exec -a "$0" "$HERE/chromedriver"  "$@"  (you can provide custom location of driver too).
        
      • 包含在路径中

        sudo ln  -s /opt/google/chrome/google-chromedriver /usr/bin/chromedriver  
        
      • 更改权限:

        chmod +x chromedriver
        

    【讨论】:

      猜你喜欢
      • 2019-12-23
      • 2017-07-14
      • 2020-11-06
      • 2019-07-19
      • 2018-03-16
      • 2023-02-23
      • 1970-01-01
      • 2013-05-31
      • 1970-01-01
      相关资源
      最近更新 更多