这些是我的设置:
.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
UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
我至少研究了两天,但没有发现任何相关信息,我看到了很多错误,但没人这样。
我找不到与我的需求相匹配的docker映像。
这是量角器网站推荐的地址: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浏览器 会话。
您的主要问题是所使用的二进制版本之间的 不兼容性 ,如下所示:
支持 Chrome版本78
支持 Chrome版本79
因此, ChromeDriver v78.0 和 Chrome浏览器v79.0 之间存在明显的不匹配 __
确保这件事: