首页 > 解决方案 > 使用 Selenium Web 驱动程序和无头 Chrome 浏览器的 UI 自动化在 Linux 服务器上花费更多时间

问题描述

我们有一个 Angular 应用程序,我们正在使用 Selenium Web Driver(version) 进行测试。我们在 2 种模式下执行了此测试,即 Selenium hub nspoke 模型,其中自动化二进制文件在 Linux 服务器上运行,应用程序投影在 Windows 机器上。其次,在 Linux 服务器本身上使用无头模式的 Chrome 进行自动化二进制运行和应用程序投影。我们观察到,在第二种方法中,它比第一种方法花费更多时间。此外,浏览器会间歇性地崩溃。
组件版本如下:-

  1. Chrome 版本 -> 83.0.4103.61
  2. 硒版本-> 3.14.0
  3. 角度版本-> 5.2.11
  4. Linux 服务器操作系统版本 -> CentOS Linux 版本 7.6.1810 (Core) 你知道 Chrome 的指定版本在无头模式下运行 Selenium 自动化时是否有任何问题吗?如果否,您能否提出解决此问题的方法?

以下是错误堆栈跟踪:-

java.lang.AssertionError: org.openqa.selenium.WebDriverException: chrome 无法访问

(会话信息:无头 chrome=83.0.4103.61)

构建信息:版本:'3.14.0',修订:'aacccce0',时间:'2018-08-02T20:19:58.91Z'

系统信息:主机:'rduqa01',ip:'192.168.160.69',os.name:'Linux',os.arch:'amd64',os.version:'3.10.0-957.el7.x86_64',java .版本:'1.8.0_181'

驱动程序信息:org.openqa.selenium.chrome.ChromeDriver

功能 {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.61, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: /tmp/.com.google.Chrome.SoqORf}, goog:chromeOptions: { debuggerAddress: localhost:16303}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000,脚本:30000},unhandledPromptBehavior:关闭并通知,webauthn:virtualAuthenticators:true}

会话 ID:3a7b3dd65ea01f9eba09d6f6bc11b7b8

*** 元素信息:{Using=id, value=back-to-main-menu}

在 org.junit.Assert.fail(Assert.java:88)

在 org.junit.Assert.assertTrue(Assert.java:41)

标签: seleniumselenium-webdriverui-automationgoogle-chrome-headlessheadless-browser

解决方案


推荐阅读