首页 > 解决方案 > git上的硒中的NoSuchSessionException

问题描述

我在 Firefox 浏览器上运行 selenium 脚本。该脚本在本地系统上执行良好,但是当我们将代码推送到 GIT 并执行管道时,它会在执行一些步骤后通过抛出以下异常而中断:

org.openqa.selenium.NoSuchSessionException: Tried to run command without establishing a connection
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'XXXXXXXXXXXXX', ip: '1XXXXXX', os.name: 'Linux', os.arch: 'amd64', os.version: 'XXXXX-aws', java.version: '1.8.0_242'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 75.0,   javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20200403170909,  moz:geckodriverVersion: 0.26.0, moz:headless: false, moz:processID: 64, moz:profile: /tmp/rust_mozprofilerzeT93, moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX,   platformVersion: 00000aws, rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: 7061f603-50d8-48c7-bfc0-e75...}
Session ID: 7061f603-50d8-48c7-bfc0-e7540fd5c115

YML 文件有这个代码来获取 Firefox 驱动程序:

services:
    - selenium/standalone-Firefox 

铬也会发生同样的事情。当系统没有找到该元素并去截屏脚本时我观察到的会引发此错误。这是间歇性的,有些时候效果很好。

如果遇到此类问题,请提供帮助。

标签: selenium-webdrivergitlabselenium-chromedrivergitlab-ci

解决方案


推荐阅读