添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed from unknown error: web view not found #1200 selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed from unknown error: web view not found #1200 AnandPalabhavi opened this issue Mar 23, 2022 · 8 comments

When i run the single job in Jenkins its working fine, But if i trigger the parallel jobs in Jenkins I'm getting below exception (Running with google chrome) Can someone help with this exception?

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_hooks.py", line 265, in call
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/main.py", line 348, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_hooks.py", line 265, in call
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/var/lib/jenkins/workspace/VF_SNOW_Python_Job/conftest.py", line 159, in pytest_runtest_protocol
INTERNALERROR> reports = runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 126, in runtestprotocol
INTERNALERROR> reports.append(call_and_report(item, "call", log))
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 217, in call_and_report
INTERNALERROR> report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_hooks.py", line 265, in call
INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 55, in _multicall
INTERNALERROR> gen.send(outcome)
INTERNALERROR> File "/var/lib/jenkins/workspace/VF_SNOW_Python_Job/conftest.py", line 42, in pytest_runtest_makereport
INTERNALERROR> extra.append(pytest_html.extras.url(get_current_url()))
INTERNALERROR> File "/var/lib/jenkins/workspace/VF_SNOW_Python_Job/helpers/mcmp_driver_manager.py", line 152, in get_current_url
INTERNALERROR> return driver.current_url
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 669, in current_url
INTERNALERROR> return self.execute(Command.GET_CURRENT_URL)['value']
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
INTERNALERROR> self.error_handler.check_response(response)
INTERNALERROR> File "/var/lib/jenkins/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
INTERNALERROR> raise exception_class(message, screen, stacktrace)
INTERNALERROR> selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed
INTERNALERROR> from unknown error: web view not found
INTERNALERROR> (Session info: headless chrome=89.0.4389.114)
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
" main ", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pytest/ main .py", line 5, in
raise SystemExit(pytest.console_main())
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/config/ init .py", line 185, in console_main
code = main()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/config/ init .py", line 163, in main
config=config
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_hooks.py", line 265, in call
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/main.py", line 316, in pytest_cmdline_main
return wrap_session(config, _main)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/main.py", line 305, in wrap_session
session=session, exitstatus=session.exitstatus
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_hooks.py", line 265, in call
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 55, in _multicall
gen.send(outcome)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/terminal.py", line 803, in pytest_sessionfinish
outcome.get_result()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 103, in pytest_sessionfinish
session._setupstate.teardown_all()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 412, in teardown_all
self._pop_and_teardown()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 387, in _pop_and_teardown
self._teardown_with_finalization(colitem)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 405, in _teardown_with_finalization
self._callfinalizers(colitem)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 402, in _callfinalizers
raise exc
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/runner.py", line 395, in _callfinalizers
fin()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/fixtures.py", line 1034, in finish
raise exc
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/fixtures.py", line 1027, in finish
func()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/_pytest/fixtures.py", line 941, in _teardown_yield_fixture
next(it)
File "/var/lib/jenkins/workspace/VF_SNOW_Python_Job/conftest.py", line 85, in driver_get
load_base_page(tenant)
File "/var/lib/jenkins/workspace/VF_SNOW_Python_Job/pages/common/login_page.py", line 132, in load_base_page
load_url(app_url)
File "/var/lib/jenkins/workspace/VF_SNOW_Python_Job/helpers/mcmp_driver_manager.py", line 135, in load_url
driver.get("https://" + app_url)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed
from unknown error: web view not found

(Session info: headless chrome=89.0.4389.114)

Google chrome=89.0.4389.114
Chrome Driver version = 89.0.4389.23

using these browser options
options.binary_location = "/usr/bin/google-chrome"
options.add_argument("--remote-debugging-port=9222")
options.add_argument("--disable-gpu")
options.add_argument("--disable-infobars")
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("--aggressive-cache-discard")
options.add_argument("--disable-cache")
options.add_argument("--disable-offline-load-stale-cache")
options.add_argument("--disk-cache-size=0")
options.add_argument("--headless")
options.add_argument("--dns-prefetch-disable")
options.add_argument("--no-proxy-server")
options.add_argument("--log-level=3")
options.add_argument("--silent")
options.add_argument("--disable-browser-side-navigation")
options.add_argument("--disable-features=VizDisplayCompositor")
#options.setPageLoadStrategy(PageLoadStrategy.NORMAL)
options.page_load_strategy = 'normal'

Hello,
Today we also have somes issues at driver.close():

Failed to quit driver with following error: OpenQA.Selenium.WebDriverException: invalid session id
Failed to quit driver with following error: OpenQA.Selenium.WebDriverException: chrome not reachable

I'm not sure if it's the same issue or not, but could be related.
Reproducing only when we run from jenkins

(Session info: chrome=99.0.4844.51)