Мой скрипт работает с хромом используя библиотеку selenium, код работает, но когда я вкл мод --headless скрипт крашится. Код ошибки:
Exception in thread Exception in thread Thread-3 (main):
Traceback (most recent call last):
File "", line 1016, in _bootstrap_inner
Thread-1 (main):
Traceback (most recent call last):
File "", line 1016, in _bootstrap_inner
self.run()
File "", line 953, in run
self.run()
File "", line 953, in run
self._target(*self._args, **self._kwargs)
File "", line 41, in main
self._target(*self._args, **self._kwargs)
File "", line 41, in main
browser.switch_to.window(new_handle)
File "", line 135, in window
browser.switch_to.window(new_handle)
File "", line 135, in window
self._w3c_window(window_name)
File "", line 143, in _w3c_window
self._w3c_window(window_name)
File "", line 143, in _w3c_window
send_handle(window_name)
File "", line 139, in send_handle
send_handle(window_name)
File "", line 139, in send_handle
self._driver.execute(Command.SWITCH_TO_WINDOW, {"handle": h})
File "", line 444, in execute
self._driver.execute(Command.SWITCH_TO_WINDOW, {"handle": h})
File "", line 444, in execute
self.error_handler.check_response(response)
File "", line 249, in check_response
self.error_handler.check_response(response)
File "", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id
Stacktrace:
Backtrace:
Ordinal0 [0x0038ACD3+2075859]
Ordinal0 [0x0031EE61+1633889]
Ordinal0 [0x0021B680+571008]
Ordinal0 [0x0023FBAD+719789]
Ordinal0 [0x00240F3F+724799]
GetHandleVerifier [0x0063EED2+2769538]
GetHandleVerifier [0x00630D95+2711877]
GetHandleVerifier [0x0041A03A+521194]
GetHandleVerifier [0x00418DA0+516432]
Ordinal0 [0x0032682C+1665068]
Ordinal0 [0x0032B128+1683752]
Ordinal0 [0x0032B215+1683989]
Ordinal0 [0x00336484+1729668]
BaseThreadInitThunk [0x7720FA29+25]
RtlGetAppContainerNamedObjectPath [0x77CE7BBE+286]
RtlGetAppContainerNamedObjectPath [0x77CE7B8E+238]