Token导航 LogoToken导航TokenDH.com
QA SERVER PYTHON logo
运维云端stdio官方级别未说明来源级核验

QA SERVER PYTHON

MCP Server

一个基于Selenium MCP Server的测试自动化工具,支持行为驱动开发(BDD)和页面对象模型(POM)模式,能够自动修复失败的测试场景。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
测试自动化Python云端部署

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ivandpulidoh

提供方

ivandpulidoh

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m venv venv

详细介绍

基于BDD和页面对象模型的Selenium MCP服务器测试自动化

项目描述

此项目使用 Selenium MCP服务器 使用以下命令创建测试自动化 行为驱动开发(BDD), python,以及 页面对象模型(POM) 图案。该系统能够仅使用特征文件中描述的步骤构建完整的自动化,并能够自动修复损坏的场景。

主要特点

  • 🤖 智能自动化:从自然语言描述生成自动化代码(Gherkin)
  • 🔧 汽车修理:能够检测并自动修复失败的测试场景
  • 📋 BDD与行为:使用Python的Behave框架进行测试实现
  • 🏗️ 页面对象模型:测试架构遵循POM模式,以提高可维护性
  • 🔌 MCP集成:使用Selenium MCP服务器通过MCP工具与浏览器交互

视频演示

您可以在以下视频中看到该项目如何运作的一个实际示例:

![Video Demo](https://youtu.be/3d_phRen8Hk)

直接链接: 在YouTube上观看视频

视频显示了一个简短的示例,说明如何使用Selenium MCP服务器创建BDD和页面对象模型模式的自动化。

项目架构

mcp-qa-server-python/
├── features/                    # BDD feature files (Gherkin)
│   ├── sign_in.feature         # Example feature for registration on utest.com
│   └── steps/                  # Step definitions
├── pages/                       # Page Objects following the POM pattern
│   └── base_page.py            # Base class for all page objects
├── selenium_mcp_server/        # MCP server references
├── requirements.txt            # Project dependencies
├── behave.ini                  # Behave configuration
└── README.MD                   # This file

使用的技术

  • python:主要编程语言
  • :Web自动化框架
  • 表现:Python的BDD框架
  • WebDriver管理器:自动浏览器驱动程序管理
  • MCP(模型上下文协议):与Selenium服务器通信的协议

安装与配置

先决条件

  • Python 3.7或更高版本
  • 已安装Chrome浏览器
  • 通过互联网下载驱动程序

安装步骤

  1. 克隆存储库 (如适用):
   git clone 
   cd mcp-qa-server-python
  1. 创建虚拟环境 (推荐):
   python -m venv venv
  1. 激活虚拟环境:

- 窗户:

     venv\Scripts\activate

- Linux/Mac:

     source venv/bin/activate
  1. 安装依赖项:
   pip install -r requirements.txt

依赖项

该项目需要以下依赖项(请参见 requirements.txt):

  • behave==1.2.6:Python的BDD框架
  • selenium==4.15.2:Web自动化框架
  • webdriver-manager==4.0.1:自动驾驶员管理

运作原理

工作流程

自动化过程遵循以下步骤:

  1. 场景定义A. .feature 文件是用Gherkin语言创建的测试场景
  1. 使用MCP服务器执行:MCP LLM客户端(游标、Visual Studio代码等)使用Selenium_MCP_Server工具来:

- 打开浏览器 - 导航到URL - 与元素交互(单击、键入、选择) - 验证页面状态

  1. 代码生成:LLM检索使用的选择器并生成:

- 页面对象:表示遵循POM模式的网页的类 - 步骤定义:要素文件中定义的步骤的实现

  1. 执行和验证:使用以下命令执行测试:
   behave features/sign_in.feature
  1. 汽车修理:如果测试失败,系统会尝试自动修复场景,直到它正常工作

用法示例

特征文件(Gherkin)

Feature: Register on the utest.com website

    @TC-01
    Scenario: Fill in all the required fields for step 1
        Given I open de browser
        When  I navigate to "utest.com"
        And I click on the "Join Now" button
        Then I wait for the page "https://utest.com/signup/personal" to load
        When I fill the fields of the form
            | type   | field_name     | value              |
            | input  | First name:    | Ruben              |
            | input  | Last name:     | Smith              |
            | input  | Email address: | rsmith@example.com |
            | select | Month          | February           |
            | select | Day            | 5                  | 
            | select | Year           | 2000               |
        Then I valid that all fields have been filled correctly
        When I click on the "Next: Location" button
        Then I wait for the page "https://utest.com/signup/address" to load

提示LLM

Execute the steps described in the sign_in.feature file in Chrome using selenium-mcp-server and create the step definitions using the selectors you use to follow them; create the necessary page objects following the Page Object Model pattern.

After creating the step definitions and page models, run the command behave features/sign_in.feature to test the correct operation of the created code. If it fails, repair the test.

页面对象结构

该项目使用页面对象模型模式来组织代码:

基础页面

BasePage 类为所有页面对象提供通用功能:

  • wait_for_url():等待URL与预期的URL匹配
  • wait_for_element():等待元素出现
  • wait_for_element_clickable():等待元素可点击

所有页面对象都继承自 BasePage 以保持一致性和代码可重用性。

测试执行

运行特定功能

behave features/sign_in.feature

与Selenium MCP服务器集成

该项目使用 Selenium MCP服务器 其提供MCP工具用于:

  • 启动和控制浏览器
  • 导航到URL
  • 与页面元素交互
  • 捕获屏幕截图
  • 验证元素是否存在
  • 以及许多其他网络自动化操作

这种方法的优点

  1. 可维护性:代码按照既定模式(POM)组织
  2. 可读性:测试是用自然语言(Gherkin)编写的
  3. 可重复使用性:页面对象可以在多个测试中重用
  4. 智能自动化:LLM可以自动生成和修复代码
  5. 可扩展性:易于添加新功能和场景

参考文献

目录标签

目录标签

测试自动化Python云端部署本地部署行为驱动开发页面对象模型Selenium

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP