Custom Table Mapping
On websites, tables can be constructed with a variety of HTML tags. Typically, these include tags such as <table>, <tr> for rows, and <td> for columns. However, other tags, such as <div>, can be used to create the appearance of a table for a user. These permutations can make the testing of tables challenging.
If you attempt to test data within a table using simple locators for the individual cells, this will usually lead to brittle and high-maintenance tests. The reasons for this include the following:
- Tables can be re-sorted, resulting in the unique row of data in the table having a new locator
- The data in the table can be unique each time you visit the web page, producing different HTML
- Table HTML can be very repetitive, making it challenging to find an element
Defining a custom table is a one-time activity. Once completed, it can reduce future maintenance on brittle locators.
Access world-class customer support at the Provar Success Portal
If you face any issues when mapping a particular table, please get in touch with us, and we would be happy to help. To raise a case, simply log into the Provar Success Portal and click View/Raise Case. Providing ongoing support is part of our promise to help you deliver robust, scalable, and repeatable testing to achieve release agility, drive down system errors, and get the maximum return on your Salesforce investment. Please contact us for more information.
Add table mapping
First, create a Selenium UI connection using UI Connect to follow this example. The example below is taken from the HTML Tables page on w3schools.com.
To construct a custom table in Automation, select Add a Table Mapping from the Test Palette in Test Builder.
This will display a few fields which can be used to define a table.
How to complete the fields
There are two methods to complete the data to define a table.
Option A: Choose the Start Selection button next to Table Locator. This is highlighted in red in the screenshot above.
Option B: Inspect the HTML using right-click and Inspect in Chrome.
Add Table Mapping Start Selection
Step 1: Launch Test Builder and navigate to the table in your browser.
Step 2: Select the Start Selection option, and the icon color will change to blue.
Step 3: Click on the table’s first cell and drag it to a cell on the outer limits. This does not need to be in the final row but should include the final column.
Step 4: If successful, you should see the cells in red. Automation cannot work out some table XPaths. You will need to inspect the HTML to fill out the fields. See the Understanding table mapping in page objects support article to help you define those types of tables.
Note: The fields for Add Table Mapping should not be populated with XPaths.
Step 5: If you are familiar with XPaths, you can verify what Automation has derived. You may update the XPaths manually.
Step 6: Add a Table Name and click Add. Automation will now write this definition into the page object you have selected, and no test step has been added. Ensure that the new page name is set to a unique name, or select the existing page object if one exists already.
Add Columns to the table.
It is necessary to select each column one at a time.
Step 1: Map the first column you want to reference in your test. Choose the data row, not the header row. If the table definition was successful, you will notice that the table is mentioned in Test Builder. If an incorrect page object is defaulted, select the correct existing one from the drop-down menu.
Step 2: Now, we need to add the relative XPath for the column. The initial XPath presented will usually need amending to refer to all elements in that column. In the example below, this means removing the text from the XPath and adding 1 to signify the first <td>.
Test Builder will assist using highlighting. If the column you are mapping is fully highlighted in red, that is correct.
Before
After modifying the field locator
Step 3: Provide a Field Name and choose Add and Do. This will add a test step called With Row to the test case, plus a nested test step referring to the column. You should expect a warning message that the XPath matches multiple elements.
What does With Row do?
The With Row test step will identify which row to interact with. When you first add the step, it will default to Row Number 1. You will most likely want to update this. Otherwise, you will constantly interact with the first row of the table. To update this, you can edit the With Row test step in Test Builder or Automation.
In the image above, you’ll notice that 1 is listed in the Row Locator field. This can be replaced with a comparison statement enclosed with curly braces {}. The comparison is typically:
{ColumnName = 'Island Trading'}
Or, if using a local variable, use a dollar sign ahead of that variable.
{ColumnName = $IslandTrainingVariable}
When the With Row is executed, it will search the full table to match the criteria. Once located, it knows that all child test steps will only operate on that row of data. If you want to test the comparison, update the Row Locator and choose Step Backwards to rerun the test steps.
To complete the table mapping, keep adding the columns you require.
Check out the Understanding Table Mappings support article to become familiar with the Java syntax Automation used to persist the table definition.
- Provar Automation
- System Requirements
- Browser and Driver Recommendations
- Installing Provar Automation
- Updating Provar Automation
- Licensing Provar
- Granting Org Permissions to Provar Automation
- Optimizing Org and Connection Metadata Processing in Provar
- Using Provar Automation
- Understanding Provar’s Use of AI Service for Test Automation
- Provar Automation
- Creating a New Test Project
- Import Test Project from a File
- Import Test Project from a Remote Repository
- Import Test Project from Local Repository
- Commit a Local Test Project to Source Control
- API Testing
- Behavior-Driven Development
- Consolidating Multiple Test Execution Reports
- Creating Test Cases
- Custom Table Mapping
- Functions
- Debugging Tests
- Defining a Namespace Prefix on a Connection
- Defining Proxy Settings
- Environment Management
- Exporting Test Cases into a PDF
- Exporting Test Projects
- Japanese Language Support
- Override Auto-Retry for Test Step
- Customize Browser Driver Location
- Mapping and Executing the Lightning Article Editor in Provar
- Managing Test Steps
- Namespace Org Testing
- NitroX
- Provar Test Builder
- ProvarDX
- Refresh and Recompile
- Reintroduction of CLI License Check
- Reload Org Cache
- Reporting
- Running Tests
- Searching Provar with Find Usages
- Secrets Management and Encryption
- Setup and Teardown Test Cases
- Tags and Service Level Agreements (SLAs)
- Test Cycles
- Test Data Generation
- Test Plans
- Testing Browser Options
- Tooltip Testing
- Using the Test Palette
- Using Custom APIs
- Callable Tests
- Data-Driven Testing
- Page Objects
- Block Locator Strategies
- Introduction to XPaths
- Creating an XPath
- JavaScript Locator Support
- Label Locator Strategies
- Maintaining Page Objects
- Mapping Non-Salesforce fields
- Page Object Operations
- ProvarX™
- Refresh and Reselect Field Locators in Test Builder
- Using Java Method Annotations for Custom Objects
- Applications Testing
- Provar Manager
- How to Use Provar Manager
- Provar Manager Setup
- Provar Manager Integrations
- Release Management
- Test Management
- Test Operations
- Provar Manager and Provar Automation
- Setting Up a Connection to Provar Manager
- Object Mapping Between Automation and Manager
- How to Upload Test Plans, Test Plan Folders, Test Plan Instances, and Test Cases
- Provar Manager Filters
- Uploading Callable Test Cases in Provar Manager
- Uploading Test Steps in Provar Manager
- How to Know if a File in Automation is Linked in Test Manager
- Test Execution Reporting
- Metadata Coverage with Manager
- Provar Grid
- DevOps
- Introduction to Provar DevOps
- Introduction to Test Scheduling
- Apache Ant
- Configuration for Sending Emails via the Automation Command Line Interface
- Continuous Integration
- AutoRABIT Salesforce DevOps in Provar Test
- Azure DevOps
- Running a Provar CI Task in Azure DevOps Pipelines
- Configuring the Automation secrets password in Microsoft Azure Pipelines
- Parallel Execution in Microsoft Azure Pipelines using Multiple build.xml Files
- Parallel Execution in Microsoft Azure Pipelines using Targets
- Parallel execution in Microsoft Azure Pipelines using Test Plans
- Bitbucket Pipelines
- CircleCI
- Copado
- Docker
- Flosum
- Gearset
- GitHub Actions
- Integrating GitHub Actions CI to Run Automation CI Task
- Remote Trigger in GitHub Actions
- Parameterization using Environment Variables in GitHub Actions
- Parallel Execution in GitHub Actions using Multiple build.xml Files
- Parallel Execution in GitHub Actions using Targets
- Parallel Execution in GitHub Actions using Test Plan
- Parallel Execution in GitHub Actions using Job Matrix
- GitLab Continuous Integration
- Travis CI
- Jenkins
- Execution Environment Security Configuration
- Provar Jenkins Plugin
- Parallel Execution
- Running Provar on Linux
- Reporting
- Salesforce DX
- Git
- Version Control
- Salesforce Testing
- Recommended Practices
- Salesforce Connection Best Practices
- Improve Your Metadata Performance
- Java 21 Upgrade
- Testing Best Practices
- Automation Planning
- Supported Testing Phases
- Provar Naming Standards
- Test Case Design
- Create records via API
- Avoid using static values
- Abort Unused Test Sessions/Runs
- Avoid Metadata performance issues
- Increase auto-retry waits for steps using a global variable
- Create different page objects for different pages
- The Best Ways to Change Callable Test Case Locations
- Working with the .testProject file and .secrets file
- Best practices for the .provarCaches folder
- Best practices for .pageObject files
- Troubleshooting
- How to Use Keytool Command for Importing Certificates
- Installing Provar After Upgrading to macOS Catalina
- Browsers
- Configurations and Permissions
- Connections
- DevOps
- Error Messages
- Provar Manager 3.0 Install Error Resolution
- Provar Manager Test Case Upload Resolution
- Administrator has Blocked Access to Client
- JavascriptException: Javascript Error
- macOS Big Sur Upgrade
- Resolving Failed to Create ChromeDriver Error
- Resolving Jenkins License Missing Error
- Resolving Metadata Timeout Errors
- Test Execution Fails – Firefox Not Installed
- Selenium 4 Upgrade
- Licensing, Installation and Firewalls
- Memory
- Test Builder and Test Cases
- Release Notes