雨停江南Lujier 2019-12-26 12:56 采纳率: 0%
浏览 1307

App自动化报错:Proxy error: Could not proxy command to remote server. Original error: 404 - undefined

    App启动参数如下(存放在Yaml文件中):

automationName: UiAutomator2
platformName: Android
platformVersion:  7
deviceName: Android Emulator
appPackage: com.ellabook
appActivity: com.ellabook.startup.StartActivity
noReset: False
unicodeKeyboard: True
# 将键盘给隐藏起来
resetKeyboard: True

    
其他信息:

      Appium 1.15

      模拟器: 雷电模拟器4.0.7

      测试框架: pytest

conftest.py内容如下:

def basedriver(port=4723, **kwargs):
    """ 根据设置的参数,启动会话,并返回会话对象
    :param port: 会话启动端口号---int
    :param kwargs: 启动参数
    :return: 会话对象
    """
    yamls = YAML(typ='safe')
    yaml_path = os.path.join(CAPS_PATH, "desire_caps.yaml")
    fs = open(yaml_path, encoding='UTF-8')
    desire_caps = yamls.load(fs)
    if kwargs:
        for key, value in kwargs.items():
            desire_caps[key] = value

    driver = webdriver.Remote("http://localhost:{}/wd/hub".format(port), desire_caps)
    return driver

@pytest.fixture(scope="class")
def initdriver_first_start():
    """App首次启动"""
    driver = basedriver(noReset=False)
    yield driver
    driver.close()
测试用例py文件内容:
@pytest.mark.usefixtures("initdriver_first_start")
class TestAPPStart:
    """APP启动页测试:
     是否进入启动页 、banner图正常滑动、点击"开始看书吧"进入登录界面
    """

    def test_0_into_start(self, initdriver_first_start):
        """APP首次启动,启动页是否展示“开始阅读吧”按钮 """
        driver = initdriver_first_start
        AppStartPage(driver).check_read_book_is_exist()

    def test_banner_left_slip(self, initdriver_first_start):
        """APP首次启动,启动页广告图能够向左滑"""
        driver = initdriver_first_start
        AppStartPage(driver).slide_start_banner("left")  # App首次启动,banner广告图正常切换

    def test_banner_right_slip(self, initdriver_first_start):
        """APP首次启动,启动页广告图能够能够向右滑"""
        driver = initdriver_first_start
        AppStartPage(driver).slide_start_banner("right")  # App首次启动,banner广告图正常切换

    def test_click_button(self, initdriver_first_start):
        """APP首次启动,点击开始按钮,查看是否进入登录界面"""
        driver = initdriver_first_start
        AppStartPage(driver).click_start_read()  # 点击“开始阅读” 按钮
        LoginPage(driver).check_into_login_idle()  # 查看是否进入登录界面

APP启动页测试 测试类(pytest/py.test方式)运行,此时用例执行完成后,在进行测试类的teardown时,却报错:

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 404 - undefined
图片说明

 网上百度了一堆资料,但依旧没有相关: 404 - undefined 的报错类型的解决方法(忧伤)

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-07-27 23:18
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    根据您提供的错误信息,这似乎是一个与Appium服务器有关的问题。在尝试使用Appium和Selenium结合进行自动化测试时,可能会遇到类似的问题。

    首先,请确保您的Appium服务器配置正确,并且能够正常工作。您可以检查以下几点来确认问题所在:

    1. Appium服务器配置

      • 确保您的Appium服务器正在运行。
      • 确认您的Appium服务器地址和端口正确无误。
      • 确保您已添加到系统环境变量中。
      • 确保您的Appium服务已经启用。
    2. 网络连接

      • 确保您的计算机或手机有稳定的互联网连接。
      • 检查是否有防火墙规则阻止了Appium请求。
    3. Python库安装

      • 确保您使用的Python版本是最新版本,以支持最新的Selenium和Appium库。
      • 确保您已正确安装了seleniumwebdriver-manager等依赖项。
    4. 测试环境

      • 您的测试环境应该包括一个可以访问Appium服务器的虚拟机或者模拟器。
      • 如果是在真实的Android设备上测试,确保设备已连接至正确的网络。
    5. 代码调试

      • 在测试过程中,仔细记录任何异常消息,以便更深入地理解问题。
      • 使用Python的调试工具(如pdb、print语句)来逐步分析代码执行过程中的状态。
    6. API文档

      • 查阅Appium API文档,了解如何通过HTTP代理发送命令到远程服务器。
      • 确认在调用Appium命令时是否指定了正确的HTTP代理URL。

    如果以上步骤都无法解决问题,可能需要进一步排查问题根源。例如,检查Appium日志文件,查找具体的错误日志信息。此外,还可以考虑联系Appium官方技术支持获取帮助。

    评论

报告相同问题?