首页 > 解决方案 > 尝试在本地而不是在 GitLab 中触发弹出窗口,给出 org.openqa.selenium.NoSuchWindowException: Browsing context has been discarded

问题描述

我正在测试一个弹出窗口,它是通过以任何方式(包括切换标签等)将光标移出页面内容来触发的。

在本地,我尝试切换选项卡,按偏移量移动光标,单击 URL,它们都在本地工作,但我的测试在 GitLab 中失败。

尝试按偏移量单击时遇到的错误之一是:

org.openqa.selenium.NoSuchWindowException: Browsing context has been discarded
Build info: version: '3.141.59'
java.version: '1.8.0_282'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 85.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20210118153634, moz:geckodriverVersion: 0.29.0, moz:headless: false, moz:processID: 75, moz:profile: /tmp/rust_mozprofileTi9Klr, moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.19.0-13-amd64, rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: a30a1170-c58e-4aa5-8e2d-5dd...}
Session ID: a30a1170-c58e-4aa5-8e2d-5dd1e56d192e
*** Element info: {Using=id, value=header}

我无法弄清楚如何在不破坏浏览器的情况下触发 gitlab 中的弹出窗口。它也不适用于 Chrome。

标签: seleniumselenium-webdrivergitlab-cigauge

解决方案


推荐阅读