报错第一行
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
报错中间错误内容详情
# 情况一
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot activate web view
# 情况二
selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id
主要原因在于启动selenium的Node容器时,没有指定--shm-size,shm 分区设置太小导致 share memory 不够
docker启动Node容器时,指定--shm-size大小等2g,
# Node 与 Hub在同一个服务器上
docker run -d --net grid --shm-size="2g" -e SE_EVENT_BUS_HOST=selenium-hub -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 selenium/node-chrome
# Node 与 Hub不在同一个服务器上,192.168.1.170是Hub服务器IP,192.168.1.72是Node服务器IP
docker run -d -p 5551:5551 --shm-size="2g" -e SE_EVENT_BUS_HOST=192.168.1.170 -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 -e SE_NODE_HOST=192.168.1.72 -e SE_NODE_PORT=5551 selenium/node-chrome
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
INTERNALERROR> """
INTERNALERROR> pytest_internalerror() was called on the worker.
INTERNALERROR>
INTERNALERROR> pytest_internalerror() arguments are an excinfo and an excrepr, which can't
INTERNALERROR> be serialized, so we go with a poor man's solution of raising an exception
INTERNALERROR> here ourselves using the formatted message.
INTERNALERROR> """
INTERNALERROR> self._active_nodes.remove(node)
INTERNALERROR> try:
INTERNALERROR> > assert False, formatted_error
INTERNALERROR> E AssertionError: Traceback (most recent call last):
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR> E session.exitstatus = doit(config, session) or 0
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR> E config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> E return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> E self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/xdist/remote.py", line 91, in pytest_runtestloop
INTERNALERROR> E self.run_one_test(torun)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/xdist/remote.py", line 110, in run_one_test
INTERNALERROR> E self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> E return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> E self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pytest_rerunfailures.py", line 240, in pytest_runtest_protocol
INTERNALERROR> E reports = runtestprotocol(item, nextitem=nextitem, log=False)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/runner.py", line 126, in runtestprotocol
INTERNALERROR> E reports.append(call_and_report(item, "call", log))
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/runner.py", line 217, in call_and_report
INTERNALERROR> E report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> E return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> E self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR> E gen.send(outcome)
INTERNALERROR> E File "/var/lib/jenkins/workspace/webui_V16/AutoWeb/testcases/conftest.py", line 63, in pytest_runtest_makereport
INTERNALERROR> E allure.attach(browser.get_screenshot_as_png(), "failed_screenshot", allure.attachment_type.PNG)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 1064, in get_screenshot_as_png
INTERNALERROR> E return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 1074, in get_screenshot_as_base64
INTERNALERROR> E return self.execute(Command.SCREENSHOT)['value']
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
INTERNALERROR> E self.error_handler.check_response(response)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
INTERNALERROR> E raise exception_class(message, screen, stacktrace)
INTERNALERROR> E selenium.common.exceptions.WebDriverException: Message: unknown error: cannot activate web view
INTERNALERROR> E (Session info: chrome=101.0.4951.41)
INTERNALERROR> E assert False
INTERNALERROR>
INTERNALERROR> /usr/local/lib/python3.9/site-packages/xdist/dsession.py:192: AssertionError
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/xdist/dsession.py", line 117, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/xdist/dsession.py", line 140, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/xdist/dsession.py", line 179, in worker_workerfinished
INTERNALERROR> assert not crashitem, (crashitem, node)
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
INTERNALERROR> """
INTERNALERROR> pytest_internalerror() was called on the worker.
INTERNALERROR>
INTERNALERROR> pytest_internalerror() arguments are an excinfo and an excrepr, which can't
INTERNALERROR> be serialized, so we go with a poor man's solution of raising an exception
INTERNALERROR> here ourselves using the formatted message.
INTERNALERROR> """
INTERNALERROR> self._active_nodes.remove(node)
INTERNALERROR> try:
INTERNALERROR> > assert False, formatted_error
INTERNALERROR> E AssertionError: Traceback (most recent call last):
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR> E session.exitstatus = doit(config, session) or 0
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR> E config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> E return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> E self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/xdist/remote.py", line 91, in pytest_runtestloop
INTERNALERROR> E self.run_one_test(torun)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/xdist/remote.py", line 110, in run_one_test
INTERNALERROR> E self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> E return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> E self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pytest_rerunfailures.py", line 240, in pytest_runtest_protocol
INTERNALERROR> E reports = runtestprotocol(item, nextitem=nextitem, log=False)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/runner.py", line 126, in runtestprotocol
INTERNALERROR> E reports.append(call_and_report(item, "call", log))
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/_pytest/runner.py", line 217, in call_and_report
INTERNALERROR> E report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> E return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> E self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR> E gen.send(outcome)
INTERNALERROR> E File "/var/lib/jenkins/workspace/webui_V16/AutoWeb/testcases/conftest.py", line 63, in pytest_runtest_makereport
INTERNALERROR> E allure.attach(browser.get_screenshot_as_png(), "failed_screenshot", allure.attachment_type.PNG)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 1064, in get_screenshot_as_png
INTERNALERROR> E return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 1074, in get_screenshot_as_base64
INTERNALERROR> E return self.execute(Command.SCREENSHOT)['value']
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
INTERNALERROR> E self.error_handler.check_response(response)
INTERNALERROR> E File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
INTERNALERROR> E raise exception_class(message, screen, stacktrace)
INTERNALERROR> E selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id
INTERNALERROR> E assert False
INTERNALERROR>
INTERNALERROR> /usr/local/lib/python3.9/site-packages/xdist/dsession.py:192: AssertionError
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/xdist/dsession.py", line 117, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/xdist/dsession.py", line 140, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/xdist/dsession.py", line 179, in worker_workerfinished
INTERNALERROR> assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('xxxxxxx', <WorkerController gw3>)
INTERNALERROR> assert not 'xxxxxxx'
查看shm需要进到容器里面才能看到,宿主机是看不到的
# 宿主机上运行df -h,并没有shm
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 5.8G 0 5.8G 0% /dev
tmpfs 5.8G 0 5.8G 0% /dev/shm
tmpfs 5.8G 13M 5.8G 1% /run
tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 8.9G 42G 18% /
/dev/mapper/centos-home 42G 33M 42G 1% /home
/dev/sda1 1014M 150M 865M 15% /boot
overlay 50G 8.9G 42G 18% /var/lib/docker/overlay2/8550cb4210b3350c69cb7e94eb5c58cb0a7896f0c170b9a8876282a1c08bdaa4/merged
tmpfs 1.2G 0 1.2G 0% /run/user/0
overlay 50G 8.9G 42G 18% /var/lib/docker/overlay2/482cc63a7d4a24024f2aa53c68d5a3e13e040bae9c901c01bdf16bff0cbc4d0c/merged
overlay 50G 8.9G 42G 18% /var/lib/docker/overlay2/9132a08c38194476c12cea1dcb089548799a2f23bb476c6268d1028abc56c136/merged
overlay 50G 8.9G 42G 18% /var/lib/docker/overlay2/4b705b491fa6c4d79fd89bd0db63196be9f75b6f8eb00c6739a54df3a6ed387a/merged
overlay 50G 8.9G 42G 18% /var/lib/docker/overlay2/26c7d3374644e58d3308c977fd3bc85ca81fef9e0e159bd402499f390d289083/merged
overlay 50G 8.9G 42G 18% /var/lib/docker/overlay2/b613790f414bac0da8573428377dc00e345d7921363184f36d8149adbe2f8410/merged
# docker ps -a 找到想进入容器的名称:NAMES 一栏
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
163eb7611d62 selenium/node-firefox "/opt/bin/entry_poin…" About an hour ago Up About an hour 0.0.0.0:5556->5556/tcp, :::5556->5556/tcp, 5900/tcp sharp_lederberg
bca60d3fdca1 selenium/node-firefox "/opt/bin/entry_poin…" About an hour ago Up About an hour 0.0.0.0:5555->5555/tcp, :::5555->5555/tcp, 5900/tcp reverent_gould
517dd84cafbd selenium/node-chrome "/opt/bin/entry_poin…" About an hour ago Up About an hour 0.0.0.0:5552->5552/tcp, :::5552->5552/tcp, 5900/tcp peaceful_aryabhata
efe394f995c2 selenium/node-chrome "/opt/bin/entry_poin…" About an hour ago Up About an hour 0.0.0.0:5551->5551/tcp, :::5551->5551/tcp, 5900/tcp gracious_taussig
# docker exec -it sharp_lederberg bash 其中sharp_lederberg是docker ps -a中NAMES找到的
[root@localhost ~]# docker exec -it sharp_lederberg bash
seluser@163eb7611d62:/$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 50G 8.9G 42G 18% /
tmpfs 64M 0 64M 0% /dev
tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
shm 2.0G 0 2.0G 0% /dev/shm # 此处可以看到shm为2G
/dev/mapper/centos-root 50G 8.9G 42G 18% /etc/hosts
tmpfs 5.8G 0 5.8G 0% /proc/asound
tmpfs 5.8G 0 5.8G 0% /proc/acpi
tmpfs 5.8G 0 5.8G 0% /proc/scsi
tmpfs 5.8G 0 5.8G 0% /sys/firmware
seluser@163eb7611d62:/$ exit
[root@localhost ~]# docker exec -it 8653ccdbdc15 bash
seluser@8653ccdbdc15:/$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 50G 8.9G 42G 18% /
tmpfs 64M 0 64M 0% /dev
tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
shm 64M 0 64M 0% /dev/shm # shm默认大小为64M
/dev/mapper/centos-root 50G 8.9G 42G 18% /etc/hosts
tmpfs 5.8G 0 5.8G 0% /proc/asound
tmpfs 5.8G 0 5.8G 0% /proc/acpi
tmpfs 5.8G 0 5.8G 0% /proc/scsi
tmpfs 5.8G 0 5.8G 0% /sys/firmware
seluser@8653ccdbdc15:/$ exit