selenoid icon indicating copy to clipboard operation
selenoid copied to clipboard

selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed from unknown error: web view not found

Open AnandPalabhavi opened this issue 4 years ago • 7 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'

AnandPalabhavi avatar Mar 23 '22 06:03 AnandPalabhavi

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)

tpetru avatar Mar 23 '22 07:03 tpetru

@tpetru Yes i'm seeing this exception only in jenkins with parallell jobs execution.

AnandPalabhavi avatar Mar 23 '22 07:03 AnandPalabhavi

@AnandPalabhavi it seems to be specific to version 89.0. Is it reproducing with an older version?

vania-pooh avatar Mar 23 '22 08:03 vania-pooh

@vania-pooh U mean 99.0 I assume. For now it's seems to not repro with 98.0

Dor-bl avatar Mar 23 '22 08:03 Dor-bl

@vania-pooh i have started with v89.0.4389, where the protractor code work but not Selenium with python code.

AnandPalabhavi avatar Mar 23 '22 09:03 AnandPalabhavi

@Dor-bl For you its working with 98 version ? did you tried with parallel job execution through jenkins ?

AnandPalabhavi avatar Mar 23 '22 09:03 AnandPalabhavi

@AnandPalabhavi Yes, it work for me with Chrome 98.0 in parallel through Jenkins

Dor-bl avatar Mar 23 '22 13:03 Dor-bl

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 18 '24 01:01 github-actions[bot]