首页 > 解决方案 > 通过 Serenity 获取 zalenium 的连接超时

问题描述

我正在使用 zalenium 来测试我的宁静测试用例。它在我本地安装的 zalenium 集群中运行良好。但在产品中,我收到连接被拒绝异常:

      net.serenitybdd.core.exceptions.SerenityManagedException: The following error occurred: java.net.ConnectException: Connection refused (Connection refused)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'p43885.intra.rakuten.co.jp', ip: 'fe80:0:0:0:ca6:f890:4645:5a02%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '1.8.0_271'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 91.0.4472.77, chrome: {chromedriverVersion: 91.0.4472.19 (1bf021f248676..., userDataDir: /tmp/.com.google.Chrome.AnHcCW}, goog:chromeOptions: {debuggerAddress: localhost:40215}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(manual, http=dev-prox..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true, webdriver.remote.sessionid: 8540f081814929eb81809ed9eb4...}
Session ID: 8540f081814929eb81809ed9eb4db7ad
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)

我的宁静会议是这样的

webdriver.base.url = "https://urlName"
serenity {
  project.name = "qa-bdd-screenplay"
  take.screenshots = BEFORE_AND_AFTER_EACH_STEP
  test.root = "com.qa.test"
  tag.failures = "true"
  linked.tags = "issue"
  #  logging = "VERBOSE"
  restart.browser.for.each = scenario
  browser.maximized=true
}
serenity.proxy.http="Hostname"
serenity.proxy.http_port="XXXX"

// chrome driver & capabilities
webdriver.driver = remote
webdriver.remote.url = "https://hostname/wd/hub"
webdriver.remote.driver = chrome

chrome.capabilities.acceptSslCerts = true
chrome.capabilities.handlesAlerts = true
chrome.capabilities.acceptInsecureCerts = true
timeouts {
    implicitlywait = 20000
    fluentwait = 30000
}
//// firefox driver & capabilities
//webdriver.driver = firefox
//firefox.preferences = "browser.download.dir=/tmp;browser.helperApps.alwaysAsk.force=false;browser.download.manager.showWhenStarting=false;browser.download.useDownloadDir=true;browser.download.folderList=2;"

// iexplorer driver & capabilities
//webdriver.driver = iexplorer
//iexplorer.capabilities = "ie.ensureCleanSession=true;"

我的zalenium confs:

❯ kubectl get all
NAME                                        READY   STATUS    RESTARTS   AGE
pod/dpd-superdb-zalenium-40000-nbj7c        1/1     Running   0          68m
pod/dpd-superdb-zalenium-40000-txftk        1/1     Running   0          66m
pod/dpd-superdb-zalenium-7f9c55dfd8-vwm79   1/1     Running   0          15d

NAME                           TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
service/dpd-superdb-zalenium   NodePort   100.89.25.228   <none>        80:32364/TCP   16d

NAME                                   READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/dpd-superdb-zalenium   1/1     1            1           16d

NAME                                              DESIRED   CURRENT   READY   AGE
replicaset.apps/dpd-superdb-zalenium-7d9f57dbff   0         0         0       16d
replicaset.apps/dpd-superdb-zalenium-7f9c55dfd8   1         1         1       15d
replicaset.apps/dpd-superdb-zalenium-847cf4fd55   0         0         0       15d

我不确定这里有什么问题,我缺少的网络配置中一定有一些东西。请让我知道如何调试并找到根本原因。

标签: chromiumselenium-gridserenity-bddzalenium

解决方案


推荐阅读