gui-selelnium-mcp
v1.0.9
Published
An npm package for selenium mcp
Readme
MCP Selenium Server
A powerful Model Context Protocol (MCP) Selenium Server designed for AI-assisted UI test case generation and browser automation, fully integrated with IBM BOB. This package enables users to switch into a dedicated Selenium MCP mode inside IBM BOB, allowing automated generation, execution, and refinement of Selenium-based UI test cases through structured prompting.
✨ Overview
- Dedicated Selenium MCP mode within IBM BOB
- Selenium WebDriver browser automation support
- Intelligent UI interaction through prompt-driven workflows
- Reusable xpath support from existing frameworks
- Integration with existing page object models
- CLI verification integration support
📦 Installation
Option 1: npm Package (Recommended)
git clone [email protected]:Priyanka-Lokhande1/mcp-selenium.git
cd mcp-seleniumOption 2: Local Development
git clone [email protected]:Priyanka-Lokhande1/mcp-selenium.git
cd mcp-selenium
npm install
node src/lib/server.jsIBM BOB Integration
Once installed:
Step 1:
Switch IBM BOB to Selenium MCP mode.
Step 2:
Use structured prompts to generate Selenium test case
Best Practices for Prompting
- Specify exact source test file
- Mention reusable functions
- Mention existing xpaths
- Define page transitions clearly
- Specify form fields and values
- Mention required assertions
- Specify CLI command names
- Mention verification conditions
- Specify reference files for patterns
- Continuously monitor generation quality
- Prompt additional corrections/tweaks as needed
Example Prompt :
Create a comprehensive Selenium-based test case for tenant creation functionality in src/testcases/common/flash_grid/test_create_tenant.py that performs the following workflow:
Use the existing navi_goto_flash_grid_sub_menu function to navigate to the Tenants tab, reusing any xpaths already present in the file. Launch Firefox browser via Selenium MCP server, navigate to the cluster IP from login_data.py, authenticate with provided credentials, and access the Tenants section to click 'Create a tenant'.
When the Carbon tearsheet loads, interact with the tenant creation form by entering 'tenant1' in the Tenant name input field and clicking Next. Verify the page heading changes to 'Select systems'. Select any two enabled checkboxes from the systems table (avoiding disabled ones) and click Next again, reusing the existing Next button xpath.
On the user configuration page, populate the following fields: User group name with 'tenantUser', User name with 'testUser', select 'Administrator' from the Select tenant role dropdown, choose the first option in the User location (system) dropdown, enter 'l0destone' in both New password and Confirm password textboxes. Once all fields are filled and the Next button becomes enabled, click it.
Click the Create button to initiate tenant creation. A progress modal will appear - wait for the Close button to become clickable using the close_progress_dialog function from src/common/base_page_objs.py to locate and click the Close button.
For verification, extend src/utils/flashGrid/fg_cli.py by adding a new function that executes the 'lsgridtenant' CLI command, using the existing svcinfo_definitions.xml file to determine the correct CLI format and following the established patterns in fg_cli.py. In test_create_tenant.py, invoke this CLI function and parse the result array to verify the presence of tenant name 'tenantUser'. Assert true if found, otherwise assert false with the error message "failed to create the tenant".
Structure the test case following the patterns established in test_flashgrid_dashboard.py and test_create_add_flashgrid.py, including proper pytest markers, allure annotations, fixtures for setup, and appropriate page object model usage.
Troubleshooting :
If generated test case is incomplete:
- Refine prompt
- Add exact xpath instructions
- Specify utility functions
- Define verification commands
- Mention missing logic
Summary :
gui-selenium-mcp transforms IBM BOB into a powerful AI-assisted Selenium automation platform by combining:
- Prompt engineering
- Browser automation
- Continuous refinement
- Scalable test generation
