当前位置: 首页 > 知识库问答 >
问题:

硒::远程::D河 驱动程序信息: 驱动程序.版本: 未知

易弘亮
2023-03-14

我无法运行脚本,并显示消息:驱动程序信息:驱动程序。.

usloft5206:~/perl# java -Dwebdriver.chrome.bin="/usr/bin/google-chrome \
  --no-sandbox" -Dwebdriver.chrome.driver="/root/perl/chromedriver" \
  -Dwebdriver.chrome.whitelistedIps= \
  -jar /root/perl/selenium-server-standalone-3.141.59.jar
12:29:06.251 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
12:29:06.316 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444 2021-06-07
12:29:06.353:INFO::main: Logging initialized @298ms to org.seleniumhq.jetty9.util.log.StdErrLog
12:29:06.535 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
12:29:06.605 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
#!/usr/bin/env perl

use strict;
use warnings;
use Selenium::Remote::Driver;
use Encode 'encode';

my $driver = Selenium::Remote::Driver->new(
  browser_name => 'chrome',
  extra_capabilities => { chromeOptions => {args => [
    'window-size=1920,1080',
    'headless',
  ]}},
);

my %visited = ();
my $depth = 1;
my $url = 'https://google.com/';

spider_site($driver, $url, $depth);

$driver->quit();
usloft5206:~/perl# ./chrome.pl

Could not create new session: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=70.0.3538.16 (16ed95b41bb05e565b11fb66ac33c660b721f778),platform=Linux 3.10.0-1160.25.1.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 53 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'dominio.local', ip: '192.168.0.107', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.25.1.el7.x86_64', java.version: '1.8.0_292'
Driver info: driver.version: unknown at ./chrome.pl line 10.

usloft5206:~/perl# perl -v
This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux

CentOS Linux release 7.9.2009 (Core)

usloft5206:~/perl# chromedriver -v
ChromeDriver 70.0.3538.16 (16ed95b41bb05e565b11fb66ac33c660b721f778)

usloft5206:~/perl# chromedriver -v
ChromeDriver 91.0.4472.19 (1bf021f248676a0b2ab3ee0561d83a59e424c23e-refs/branch-heads/4472@{#288})

selenium-server-standalone-3.141.59.jar

-sh-4.2$ google-chrome --no-sandbox
[28425:28425:0607/123836.573842:ERROR:browser_main_loop.cc(1402)] Unable to open X display.
-sh-4.2$ [0607/123836.579898:ERROR:nacl_helper_linux.cc(307)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

共有1个答案

微生新霁
2023-03-14

我相信您的chrome和驱动程序不兼容。
简单的方法是使用包管理器安装它。

# yum -y install epel-release chromium chromedriver
# java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar [ your selenium standalone jar path ]

我想你是从https://www.perl.com/article/spidering-websites-with-headless-chrome-and-selenium/
这是特殊的https://example.com

以下代码对我有用:

my $driver = Selenium::Remote::Driver->new(
  browser_name => 'chrome',
  extra_capabilities => { chromeOptions => {args => [
    'window-size=1920,1080',
    'headless',
    'no-sandbox',
  ]}},
);

my %visited = ();
my $depth = 1;
my $url = 'https://example.com';

spider_site($driver, $url, $depth);

$driver->quit();

sub spider_site {
  my ($driver, $url, $depth) = @_;
  warn "fetching $url\n";
  $driver->get($url);
  warn "survive get url\n";
  $visited{$url}++;

  my $text = $driver->get_title;
  warn "survive get title\n";
  print encode('UTF-8', $text);

  if ($depth > 0) {
    warn "finding element\n";
    my @links = $driver->find_elements('a', 'tag_name');
    my @urls = ();
    for my $l (@links) {
        warn "link: $l\n";
      my $link_url = eval { $l->get_attribute('href') };
      push @urls, $link_url if $link_url;
    }
    for my $u (@urls) {
        warn "calling spider_site for url $u";
      spider_site($driver, $u, $depth - 1) unless ($visited{$u});
    }
  }
}
 类似资料:
  • 我试图在远程节点上运行selenium网格代码,但它总是引发异常。 集线器: 它会听192.168.1.106:4444 节点: 它将在192.168.1.132:5566收听 Java代码: 节点日志: 操作系统:Fedora 23,Firefox版本50.1.0,selenium独立服务器3.0.1

  • 我正在尝试从页面对象示例运行示例 它在Windows 7上运行良好,但当我试图在Linux ( Fedora 15)上运行时,我遇到了一个错误: 我尝试将系统.set属性设置为: 但是得到了同样的错误。

  • 情况是这样的:我正在使用Behat在Symfony上运行验收测试。为此,我使用Geckodriver启动一个Selenium实例,然后运行Behat。本地的一切都很好(很好!)。 但是当它在Github操作上运行时,它会失败。我已经检查了版本,我甚至版本化了gecko驱动程序和selenium.jar文件来使用完全相同的(尽管它们已经存在于github操作上),但是没有什么工作。 所以我正在寻找任

  • 在Eclipse BIRT数据资源管理器中为查询生成器添加JDBC数据库连接: 选择“查询生成器的JDBC数据库连接” 就这样。我可以使用此数据源来使用数据集。 下一个。 我希望使用更灵活的“JDBC数据源”,而不是以前成功使用的“查询生成器的JDBC数据库连接”。哦,我看到MySQL没有驱动程序类-Derby和Sample只有两个默认条目。 似乎JDBC驱动程序的有效注册没有添加(或注册?)司机

  • 问题内容: 为什么Oracle会为每个数据库数据库版本提供不同的JDBC驱动程序版本,例如ojdbc14.jar? 这些文件都有不同的大小,因此内容可能也不同。 背景: 保存数据时,我们收到一个随机且看似不可复制的错误消息,说“无效数字”(我们猜这是时间戳)。但这不是特别声明。大多数情况下,它可以节省费用。一个月一次的无害声明将失败。 因此,我仔细查看了Oracle的下载站点,发现尽管文件共享相同

  • 搜索上下文是selenium中最超级的接口,它由另一个称为网络驱动程序的接口扩展。 -所有搜索上下文和Web驱动程序接口的抽象方法都在远程WebDriver类中实现。 -所有与浏览器相关的类,如Firefox驱动程序、Chrome驱动程序等,都扩展了远程Webdriver类。 根据上面的stmt,远程web驱动程序类如何为搜索上下文接口和web驱动程序接口中定义的所有抽象方法给出定义。因为功能驱动