gpt4 book ai didi

python - GalenRemoteWebDriver 无法连接到本地主机服务器

转载 作者:行者123 更新时间:2023-12-01 07:56:17 25 4
gpt4 key购买 nike

目前我正在使用 Python 的 galen 框架。我在虚拟机和galenpy中使用Python 2.7、Ubuntu 18.04。当我运行单元测试时,我收到如下错误

MainThread - line:117 in remote_connection - Could not connect to port 4444 on host localhost
MainThread - line:136 in remote_connection - Could not get IP address for host: localhost

此框架selenium的要求, Nose 2,加伦皮,车轮,节约,皮厄姆克雷斯特,请求,我安装了所有这些,但我不知道我在哪里犯了错误。

import os
import unittest
from galenpy.galen_api import Galen
from galenpy.galen_report import TestReport, info_node, warn_node, error_node
from galenpy.galen_webdriver import GalenRemoteWebDriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


class GalenTestBase(unittest.TestCase):

def __init__(self, methodName='runTest'):
super(GalenTestBase, self).__init__(methodName)

def setUp(self):
self.driver = GalenRemoteWebDriver("http://localhost:4444/wd/hub", desired_capabilities=DesiredCapabilities.FIREFOX)

def tearDown(self):
if self.driver:
self.driver.quit()

def check_layout(self, test_name, specs, included_tags, excluded_tags):
try:
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__) + '/..'))
test_report = TestReport(test_name)
check_layout_report = Galen().check_layout(self.driver, os.path.join(parent_dir, "test", "specs", specs),
included_tags, excluded_tags)

test_report.add_report_node(info_node("Running layout check for: " + test_name)
.with_node(warn_node('this is just an example'))
.with_node(error_node('to demonstrate reporting'))) \
.add_layout_report_node("check " + specs, check_layout_report).finalize()
if check_layout_report.errors > 0:
raise AssertionError(
"Incorrect layout: " + test_name + " - Number of errors " + str(check_layout_report.errors))

except Exception as e:
raise e

输出如下

Testing started at 10:34 ...
stdout listener - line:43 in remote_service_logging - starting listener for STDOUT

stderr listener - line:43 in remote_service_logging - starting listener for STDERR

Remote service - line:62 in remote_service_logging - starting Galen API Remote Service logger
MainThread - line:58 in remote_service_lifecycle - Started server at port 9092
Remote service - line:74 in remote_service_logging - [main] INFO galen.api.server.GalenApiServer - Starting server on port 9092
MainThread - line:117 in remote_connection - Could not connect to port 4444 on host localhost
MainThread - line:136 in remote_connection - Could not get IP address for host: localhost
Remote service - line:74 in remote_service_logging - [pool-1-thread-2] INFO galen.api.server.GalenApiServer - Setting up new WebDriver session
Remote service - line:74 in remote_service_logging - [pool-1-thread-2] ERROR galen.api.server.GalenApiServer - Could not reach browser at URL http://localhost:4444/wd/hub check remote server is running.
MainThread - line:47 in galen_webdriver - Could not reach browser at URL http://localhost:4444/wd/hub check remote server is running.
Remote service - line:74 in remote_service_logging - [pool-1-thread-4] INFO galen.api.server.GalenApiServer - Shutting down Galen API service.
Error
Traceback (most recent call last):
File "/usr/lib/python2.7/unittest/case.py", line 320, in run
self.setUp()
File "/home/yuceturk/Desktop/galen-sample-py-tests-master/src/galen_test_base.py", line 31, in setUp
self.driver = GalenRemoteWebDriver("http://localhost:4444/wd/hub", desired_capabilities=DesiredCapabilities.FIREFOX)
File "/home/yuceturk/Desktop/galen-sample-py-tests-master/venv/local/lib/python2.7/site-packages/galenpy/galen_webdriver.py", line 49, in __init__
raise e
SessionNotCreatedException: Message: Could not reach browser at URL http://localhost:4444/wd/hub check remote server is running.

最佳答案

我很久以前就创建了这个项目。很高兴看到有人想把它从灰尘中挖出来。我发现更新它可能需要一些工作。至于您的问题,您似乎没有在本地主机上运行 Selenium Grid。

关于python - GalenRemoteWebDriver 无法连接到本地主机服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55965553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com