当前位置: 首页 > 面试题库 >

此版本的ChromeDriver尚未经过Chrome 79版本的错误测试,无法通过ChromeDriver ChromeSelenium运行量角器E2E测试

符鸣
2023-03-14
问题内容

这些是我的设置:

.gitlab-ci.yml

image: node
stages:
    - test
tests:
    stage: test
    before_script:
        # Add Google Chrome to aptitude's (package manager) sources
        - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee -a /etc/apt/sources.list
        # Fetch Chrome's PGP keys for secure installation
        - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
        # Update aptitude's package sources
        - apt-get -qq update -y
        # Install latest Chrome stable, Xvfb packages
        - apt-get -qq install -y google-chrome-stable xvfb gtk2-engines-pixbuf xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable imagemagick x11-apps default-jre
        # Launch Xvfb
        - Xvfb :0 -ac -screen 0 1024x768x24 &
        # Export display for Chrome
        - export DISPLAY=:99
        # Install AngularJS CLI exclusively
        # Add --unsafe-perm to resolve problems with node-gyp infinite loop on Docker
        - npm install --silent --unsafe-perm -g @angular/cli@1.1.2
    script:
        - npm i --quiet
        - npm run wd-update
        - npm run wd-start &
        - npm run start -- js-files/psh.conf.js
        - npm run wd-shutdown
    only:
        - master
        - merge_request

这是测试的工作量

     Running with gitlab-runner 12.3.0 (a8a019e0)
     on runner-gitlab-runner-554cdd7fbc-4t8mw zxqBkdf4
     Using Kubernetes namespace: gitlab-managed-apps
     Using Kubernetes executor with image node ...
    Waiting for pod gitlab-managed-apps/runner-zxqbkdf4-project-62-concurrent-15jnmx to be running, status is Pending
    Running on runner-zxqbkdf4-project-62-concurrent-15jnmx via runner-
$ npm i --quiet

> canvas@2.6.0 install /builds/automation/bender/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
[canvas] Success: "/builds/automation/bender/node_modules/canvas/build/Release/canvas.node" is installed via remote
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 457 packages from 433 contributors and audited 1390 packages in 15.657s
found 0 vulnerabilities

$ npm run wd-update

> bender@1.0.0 wd-update /builds/automation/bender
> webdriver-manager update

[15:03:41] I/file_manager - creating folder /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium
[15:03:41] I/config_source - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/standalone-response.xml https://selenium-release.storage.googleapis.com/
[15:03:41] I/config_source - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/
[15:03:41] I/config_source - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/gecko-response.json https://api.github.com/repos/mozilla/geckodriver/releases
[15:03:42] I/downloader - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105.zip https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_linux64.zip
[15:03:42] I/downloader - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
[15:03:42] I/update - chromedriver: unzipping chromedriver_78.0.3904.105.zip
[15:03:42] I/update - chromedriver: setting permissions to 0755 for /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105
[15:03:42] I/downloader - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
[15:03:43] I/update - geckodriver: unzipping geckodriver-v0.26.0.tar.gz
[15:03:43] I/update - geckodriver: setting permissions to 0755 for /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0
$ npm run wd-start &
$ npm run start -- js-files/psh.conf.js

> bender@1.0.0 wd-start /builds/automation/bender
> webdriver-manager start


> bender@1.0.0 prestart /builds/automation/bender
> tsc && ts-cleaner -d js-files

[15:03:44] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.gecko.driver=/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0 -Dwebdriver.chrome.driver=/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105 -jar /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar -port 4444
[15:03:44] I/start - seleniumProcess.pid: 15684
15:03:45.253 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
15:03:45.506 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-12-17 15:03:45.713:INFO::main: Logging initialized @1029ms to org.seleniumhq.jetty9.util.log.StdErrLog
15:03:46.441 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
15:03:46.780 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444

> bender@1.0.0 start /builds/automation/bender
> node src/flake "js-files/psh.conf.js"

[15:03:52] I/launcher - Running 1 instances of WebDriver
[15:03:52] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
15:03:52.446 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "chromeOptions": {
    "args": [
      "--headless",
      "--no-sandbox",
      "--window-size=1550,768"
    ]
  },
  "count": 1,
  "maxInstances": 1,
  "shardTestFiles": false
}
15:03:52.449 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800}) on port 3722
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1576595032.499][SEVERE]: bind() failed: Cannot assign requested address (99)
[1576595033.109][WARNING]: This version of ChromeDriver has not been tested with Chrome version 79.
15:03:53.266 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
15:03:53.323 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 26b7b655c1318cbcde9cfb69871f56ad (org.openqa.selenium.chrome.ChromeDriverService)
(node:15719) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Started
Jasmine started
2019-12-17T15:03:53.447Z - info: Current test running: 
    Psh site validations Site language should change

(node:15719) UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'runner-zxqbkdf4-project-62-concurrent-15jnmx', ip: '10.36.0.39', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.138+', java.version: '1.8.0_232'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:509:13)
    at /builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:15719) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15719) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:15719) UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'runner-zxqbkdf4-project-62-concurrent-15jnmx', ip: '10.36.0.39', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.138+', java.version: '1.8.0_232'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:509:13)
    at /builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:15719) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15719) UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'runner-zxqbkdf4-project-62-concurrent-15jnmx', ip: '10.36.0.39', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.138+', java.version: '1.8.0_232'
Driver info: driver.version: unknown
    at Object.checkLegacyResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:509:13)
    at /builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:15719) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

所以,我的错误是: UnhandledPromiseRejectionWarning: WebDriverError: invalid session id

  • 有什么想法吗?

我至少研究了两天,但没有发现任何相关信息,我看到了很多错误,但没人这样。

  • 我应该使用docker映像吗? 而是即时安装所有内容?

我找不到与我的需求相匹配的docker映像。

  • 我使用的selenium地址正确吗?

这是量角器网站推荐的地址:seleniumAddress:’ http:// localhost:4444 / wd /
hub


问题答案:

此错误消息…

Starting ChromeDriver 78.0.3904.70
.
[1576595033.109][WARNING]: This version of ChromeDriver has not been tested with Chrome version 79.
.
15:03:53.323 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 26b7b655c1318cbcde9cfb69871f56ad (org.openqa.selenium.chrome.ChromeDriverService)
(node:15719) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

…暗示 ChromeDriver 无法启动/产生新的 浏览上下文,Chrome浏览器 会话。

您的主要问题是所使用的二进制版本之间的 不兼容性 ,如下所示:

  • 您正在使用 chromedriver = 78.0
  • chromedriver = 78.0 发行说明明确提到以下内容:

支持 Chrome版本78

  • 您正在使用 chrome = 79.0
  • ChromeDriver v79.0的 发行说明中明确提到以下内容:

支持 Chrome版本79

因此, ChromeDriver v78.0Chrome浏览器v79.0 之间存在明显的不匹配 __

确保这件事:

  • ChromeDriver 已更新为当前的ChromeDriver v79.0级别。
  • Chrome 已更新为当前的 Chrome版本79.0 。(根据ChromeDriver v79.0发行说明)
  • 清理 你的 项目工作 ,通过你的 IDE重建 仅需要依赖你的项目。


 类似资料:
  • 我已经研究了很多,并使用了各种论坛中提到的许多可能的解决方案,没有一个对我有效。我正在尝试在CI/CD管道中运行此功能,虽然能够在本地运行量角器测试用例,并且能够启动浏览器,但在CI/CD管道构建中失败,以下是详细信息 我在包中的脚本下使用以下postinstall。json 对于上面的脚本命令,下面的错误被抛出I/file_manager-创建文件夹D:\a\1\s\node_modules\量

  • 我已经研究了很多,并使用了各种论坛中提到的许多可能的解决方案,但没有一个对我有效。我试图在CI/CD管道中运行它,尽管能够在本地运行量角器测试用例并能够启动浏览器,但在CI/CD管道构建中它失败了。下面是量角器2.5.4 E/启动器-会话未创建时出现问题的详细信息:此版本的ChromeDriver仅支持Chrome版本79 我在包中的脚本下使用以下postinstall。json 对于上面的脚本命

  • 我正在VSTS中使用“基于云的ApacheJMeter负载测试”任务执行JMeter脚本。我有一个响应断言作为JMeter测试的一部分。我能够通过VSTS中的发布定义触发测试。当断言失败时,我希望发布失败。目前,发布成功,并发出如下警告: 2018-02-21T18:23:31.1885342Z##[警告][异常] 1次出现['测试'、'HTTP请求'、'网络异常']:请下载测试日志以查看此url

  • 我得到了一个错误时,打开铬与硒,它打开和关闭窗口后立即打开。下面是我的代码:

  • 我认为量角器正在寻找chromedriver的最后可用版本2.31。该版本于2天前于2017年7月22日发布。我无法使用此版本,因为它与我的centos版本(GLIBC_2.18)不兼容。 Chrome网站上说最后一个版本是Chrome驱动程序2.30。那么为什么量角器尝试使用2.31呢?这个版本没有安装。有办法强制使用特定版本吗? 谢谢。 节点版本:v8.1.3量角器版本:版本5.1.2 Chr

  • 问题内容: 我在Windows 7,硒,chromedriver版本84(最新)上使用python 3来自动运行chrome浏览器。 我正在使用此脚本: 而且我总是在运行时收到此错误。 我的ChromeDriver正在运行。我也使用了其他版本的chromedriver,但是我无法导航到网站! 问题答案: 您的ChromeDriver版本和已安装的Chrome版本需要匹配。您使用的是ChromeDr