亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Gitlab ci selenium 測試 docker 未連接到 RemoteWebDriver

Gitlab ci selenium 測試 docker 未連接到 RemoteWebDriver

手掌心 2023-07-13 17:33:25
我想使用 gitlab-ci、docker 自動運行硒測試。本地一切正常,但 docker 和 selenium 似乎存在一些連接問題。工作失敗了selenium.test.dashboard.MyTest > myFirstTest FAILED    org.openqa.selenium.remote.UnreachableBrowserException        Caused by: java.net.ConnectException            Caused by: java.net.ConnectException    java.lang.NullPointerException我嘗試更改不同的網址來連接到 selenium 服務器,我認為可能存在端口問題。但我嘗試的每一個組合都得到了相同的結果。.gitlab-ci.ymlimage: gradle:alpinevariables:  GRADLE_OPTS: "-Dorg.gradle.daemon=false"before_script:  - export GRADLE_USER_HOME=`pwd`/.gradlestages:  - build  - seleniumTestingbuild:  stage: build  script:     - echo $CI_JOB_STAGE    - echo $CI_COMMIT_REF_NAME    - gradle --build-cache war  artifacts:    paths:      - public  cache:    key: "$CI_COMMIT_REF_NAME"    policy: push    paths:      - build      - .gradleseleniumTestingChrome:  stage: seleniumTesting  script: gradle integrationTest#  services:#    - selenium/standalone-chrome:latest   services:    - name: selenium/standalone-chrome:latest   artifacts:    paths:      - build/reports/tests/  cache:    key: "$CI_COMMIT_REF_NAME"    policy: push    paths:      - build      - .gradleRemoteWebDriver 的 Java 代碼DesiredCapabilities capabilities = new DesiredCapabilities();            capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());            try {//              driver = new RemoteWebDriver( new URL("http://selenium_standalone-chrome:4444/wd/hub"), capabilities);                WebDriver driver = new RemoteWebDriver( new URL("http://127.0.0.1:4444/wd/hub"), capabilities);            } catch (MalformedURLException e) {                // TODO Auto-generated catch block                e.printStackTrace();            }在運行器上創建容器
查看完整描述

2 回答

?
翻翻過去那場雪

TA貢獻2065條經驗 獲得超14個贊

連接到 RemoteWebDriver 的 URL 錯誤。我漏掉了一個下劃線。

查看完整回答
反對 回復 2023-07-13
?
翻閱古今

TA貢獻1780條經驗 獲得超5個贊

gitlab https://docs.gitlab.com/ee/ci/services/#accessing-the-services中有一個主題,其中指出


Everything after the colon (:) is stripped.

Slash (/) is replaced with double underscores (__) and the primary alias is created.

Slash (/) is replaced with a single dash (-) and the secondary alias is created (requires GitLab Runner v1.1.0 or higher). 



查看完整回答
反對 回復 2023-07-13
  • 2 回答
  • 0 關注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號