https://github.com/nagipragalathan/webtorch
LCTP is a Selenium-based Low-Code Web Testing Automation tool in Python. It simplifies web testing using JSON configuration files, making it easy for testers and developers to automate test scenarios.
https://github.com/nagipragalathan/webtorch
lctp lowcode modules python requirements selenium web-testing web-testing-automation
Last synced: 6 months ago
JSON representation
LCTP is a Selenium-based Low-Code Web Testing Automation tool in Python. It simplifies web testing using JSON configuration files, making it easy for testers and developers to automate test scenarios.
- Host: GitHub
- URL: https://github.com/nagipragalathan/webtorch
- Owner: NagiPragalathan
- License: mit
- Created: 2023-09-03T06:22:13.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-03T08:05:56.000Z (about 2 years ago)
- Last Synced: 2025-02-11T04:11:30.049Z (8 months ago)
- Topics: lctp, lowcode, modules, python, requirements, selenium, web-testing, web-testing-automation
- Language: Python
- Homepage: https://pypi.org/project/WebTorchX/0.0.1/
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: CHANGELOG.txt
Awesome Lists containing this project
README
![]()
WebTorch ( LCTP ) - Selenium Low-Code Web Testing Automation in Python



[](https://t.me/nagipragalathan)

[](https://www.newton.so/view?tags=LCTP)

[](https://twitter.com/NagiPragalathan)**LCTP** is a Selenium-based Low-Code Web Testing Automation tool in Python. It simplifies web testing using JSON configuration files, making it easy for testers and developers to automate test scenarios.
It's a powerful tool designed to streamline your testing efforts, and we're constantly improving it. However, please note that it's still a work in progress and not ready for production use.
[Getting started](#getting-started) ~ [Supported opcodes](#supported-opcodes) ~
[Build](#build) ~ [Test](#test) ~
[Report a bug](https://github.com/)
~ [Questions](https://www.newton.so/view?tags=LCTP)![]()
Fear of coding the testing files use the LCTP to relieve your complexity and upgrade your automation using LCTP for your application.
# Setup:
## Installation:
Install LCTP using the following command: `pip install LCTP`## Usage:
{
"setup":{
"driver_path" : "../../../path",
"auto_install":"true",
"browser":"Opera",
"get":"https://www.saucedemo.com/",
"window" : "maximize"
"screen_recorder":"true",
"run_amd_wait":"true"
}
}
The `setup` keyword is mandatory when using LCTP.1. `driver_path`: Provide the path to the Selenium Chrome driver executable.
2. `auto_install`: Automatically download and install the Chrome driver if not found.
3. `browser`: Specify the browser to be used (e.g., Chrome, Firefox).
4. `get`: Define the URL of the landing page.
5. `window`: It's recommended to use "maximize" to maximize the browser window. You can also use "minimize" if needed.
6. `screen_recorder`: Enable screen recording of the testing session.
7. `run_and_wait`: Wait for the browser window to run the program.Auto_install can handle the following browsers:
1. Chrome
2. ChromeService
3. Brave
4. BraveService
5. Firefox
6. FirefoxService
7. IE
8. IEService
9. Edge
10. EdgeService
11. Opera## Get Elements
### Supported selectors: ['id', 'name', 'class', 'xpath']
'id': Get elements by their ID attribute.
'name': Get elements by their Name attribute.
'class': Get elements by their Class attribute.
'xpath': Get elements by their XPath.### Examples:
{
"setup":{
"driver_path" : "../../../path",
"auto_install":"true",
"browser":"Opera", //
"get":"https://www.saucedemo.com/", //
"window" : "maximize" //
},
"login_testing":{
"fill_user_name" : {
"id" : "user-name:sk:minimize",
"data" : "standard_user"
},
"fill_password":{
"id":"password:sk",
"data":"secret_sauce"
},
"click_login_btn":{
"id":"login-button:click"
}
},
}### Click a list of Elements line by line
list_data = ['ls_id_clk', 'ls_name_clk', 'ls_xpath_clk']
{
"setup":{
"driver_path" : "../../../path",
"auto_install":"true",
"browser":"Opera", //
"get":"https://www.saucedemo.com/", //
"window" : "maximize" //
},
"login_testing":{
"fill_user_name" : {
"id" : "user-name:sk:minimize",
"data" : "standard_user"
},
"fill_password":{
"id":"password:sk",
"data":"secret_sauce"
},
"click_login_btn":{
"id":"login-button:click"
}
},
"home_page":{
"ls_id_clk" : ["add-to-cart-sauce-labs-backpack","add-to-cart-sauce-labs-bike-light","add-to-cart-sauce-labs-fleece-jacket"],
"ls_name_clk" : ["add-to-cart-test.allthethings()-t-shirt-(red)","add-to-cart-sauce-labs-bolt-t-shirt","add-to-cart-sauce-labs-onesie"]
},
"view_cart":{
"select_select_box":{
"xpath":"//*[@id='header_container']/div[2]/div[2]/span/select:select_by_index@2"
},
"nav_to_view_cart":{
"xpath": "//*[@id='shopping_cart_container']/a:click:minimize",
"window": "maximize"
}
}
}### ScreenShot and ScreenRecorder
`"screen_recorder":"true"`: Enable screen recording from the beginning to the end of the test, and it is implemented only in the setup query. The recordings are stored in the Test_Video folder path.
`"take":"screenshot"`: Take a screenshot of the task at any line of code. The screenshots are stored in the ScreenShots folder path.### Keywords
#### Send Keys
1. `sk`: Send keys to input fields. You can send keys using two ways: `:sk` and `:sk@data`. If `:sk` is used alone, then the data should be declared in another line.
2. 'c&sk': Clear the input field and send keys, similar to `sk`.
"fill_password":{
"id":"password:sk",
"data":"secret_sauce"
},
"fill_changepassword":{
"id":"changepassword:c&sk",
"data":"secret_sauce"
},#### Window Controller
1. `window`: Use it with any field to maximize or minimize the browser window.
2. `set_window_position`: Set the position of the browser window.
"nav_to_view_cart":{
"xpath": "//*[@id='shopping_cart_container']/a:click:minimize",
"window": "maximize"
}
"nav_to_view_cart":{
"xpath": "//*[@id='shopping_cart_container']/a:click:minimize",
"window": "minimize"
}# Selenium Low-Code Web Testing Automation Hot Keys
This Python module simplifies web testing with Selenium WebDriver using a low-code approach. It enables developers or testers to write test scenarios using JSON configuration files. Below is the documentation for the project, along with code examples for each section.
## Table of Contents
1. [Installation](#installation)
2. [Usage](#usage)
- [Setup Configuration](#setup-configuration)
- [Login Testing](#login-testing)
- [Home Page Testing](#home-page-testing)
- [View Cart Testing](#view-cart-testing)
- [Additional Example](#additional-example)
3. [JSON Configuration](#json-configuration)
- [Setup Section](#setup-section)
- [Login Testing Section](#login-testing-section)
- [Home Page Section](#home-page-section)
- [View Cart Section](#view-cart-section)
4. [Advanced Features](#advanced-features)
- [Screen Recording](#screen-recording)
- [Running and Waiting](#running-and-waiting)
- [Taking Screenshots](#taking-screenshots)
- [Executing Python Code](#executing-python-code)
5. [Additional Example Configuration](#additional-example-configuration)
6. [Contributing](#contributing)
7. [License](#license)You can install this module using pip:
```
pip install selenium-webtest
```
## UsageTo use this module, follow these steps:
1. Create a JSON configuration file for your test scenarios.
2. Utilize the `WebTestExecutor` class to execute your tests.Here's how you can structure your JSON configuration file and perform different test actions:
The `setup` section in your JSON configuration file is used to set up your test environment. It includes the following parameters:
- `driver_path` (str): The path to your WebDriver executable (e.g., ChromeDriver).
- `auto_install` (str): Automatically install the WebDriver if it's not found (set to `"true"` to enable).
- `browser` (str): Specify the browser to use (e.g., "Opera").
- `get` (str): The URL of the website to be tested.
- `window` (str): Maximize the browser window (set to "maximize" to enable).**Example:**
{
"setup": {
"driver_path": "../../../path",
"auto_install": "true",
"browser": "Opera",
"get": "https://www.saucedemo.com/",
"window": "maximize"
},
...
}The `login_testing` section defines actions related to logging into a website. It includes the following parameters:
- `fill_user_name`: Fill the username input field.
- `fill_password`: Fill the password input field.
- `click_login_btn`: Click the login button.**Example:**
{
"login_testing": {
"fill_user_name": {
"id": "user-name:sk:minimize",
"data": "standard_user"
},
"fill_password": {
"id": "password:sk",
"data": "secret_sauce",
"take": "screenshot"
},
"click_login_btn": {
"id": "login-button:click"
}
},
...
}The `home_page` section defines actions for interacting with elements on the home page of the website. It includes the following parameters:
- `set_window_position` (optional): Set the position of the browser window.
- `ls_id_clk`: Click elements by their IDs.
- `ls_name_clk`: Click elements by their names.**Example:**
{
"home_page": {
"set_window_position": [10, 10],
"ls_id_clk": [
"add-to-cart-sauce-labs-backpack",
"add-to-cart-sauce-labs-bike-light",
"add-to-cart-sauce-labs-fleece-jacket"
],
"ls_name_clk": [
"add-to-cart-test.allthethings()-t-shirt-(red)",
"add-to-cart-sauce-labs-bolt-t-shirt",
"add-to-cart-sauce-labs-onesie"
]
},
...
}The `view_cart` section defines actions for viewing the shopping cart. It includes the following parameters:
- `select_select_box`: Select an option from a dropdown menu by index.
- `nav_to_view_cart`: Navigate to the shopping cart and maximize the window.**Example:**
{
"view_cart": {
"select_select_box": {
"xpath": "//*[@id='header_container']/div[2]/div[2]/span/select:select_by_index@2"
},
"nav_to_view_cart": {
"xpath": "//*[@id='shopping_cart_container']/a:click:minimize",
"window": "maximize"
}
},
...
}### Additional Example Configuration
Here's an additional example of JSON configuration to perform web testing actions:
{
"setup": {
"web_driver_location": "path",
"dict": {
"a": {
"id": "hello"
}
}
},
"login_page": {
"msg": "to login into",
"id": "id",
"name": "name",
"xpath": "xpath",
"link_text": "LINK_TEXT",
"tag_name": "TAG_NAME",
"partial_link_text": "PARTIAL_LINK_TEXT",
"class_name": "CLASS_NAME",
"css_selector": "CSS_SELECTOR",
"send_key": "values",
"sleep": "2s"
}
}This example illustrates how to configure the web driver location and login page testing actions using various element attributes.
The `setup` section includes parameters for configuring the test environment. It must be the first section in your JSON configuration file.
- `driver_path` (str): The path to the WebDriver executable.
- `auto_install` (str): Automatically install the WebDriver if not found (set to `"true"` to enable).
- `browser` (str): Specify the browser to use.
- `get` (str): The URL of the website to test.
- `window` (str): Maximize the browser window after opening.The `login_testing` section defines actions for logging into a website.
- Each action should be a JSON object with a unique name.
- Specify the target element using its attributes (e.g., `id`, `xpath`).
- Use the `data` field to provide input data (e.g., username and password).
- Use `take` to take a screenshot after the action (optional).
- Use `click` to perform a click action (optional).The `home_page` section defines actions for interacting with elements on the home page of the website.
- `set_window_position` (optional): Set the position of the browser window.
- `ls_id_clk` (list of str): Click elements by their IDs.
- `ls_name_clk` (list of str): Click elements by their names.The `view_cart` section defines actions for viewing the shopping cart.
- `select_select_box` (optional): Select an option from a dropdown menu by index.
- `nav_to_view_cart` (optional): Navigate to the shopping cart and maximize the window.Enable screen recording during testing by setting `"screen_recorder"` to `"true"` in the `setup` section.
Set `"run_and_wait"` to `"true"` in the `setup` section to make the script wait for elements to become visible or clickable before performing actions.
Take screenshots after specific actions by adding `"take": "screenshot"` to those actions in the `login_testing` section.
Execute custom Python code during testing by setting `"code"` to `"true"` in a login action. Specify your Python code in the `"python_code"` field or provide a file path using `"python_code_path"`.
## Additional Example Configuration
Here's an additional example configuration demonstrating web driver location setup and login page testing actions. You can configure various element attributes for testing different web pages.
Contributions to this project are welcome. Feel free to submit bug reports, feature requests, or pull requests on the GitHub repository.
## Usage:
-h, --help: Show this help message.
--version, --V, --v: Show version information.
-test : Run tests based on a JSON configuration file.
-req : Create a requirements.txt file.
-f : Format a single Python file.
-fa : Format all Python files in a directory.This project is licensed under the MIT License. See the LICENSE file for details.