Create a Selenium Test Case

To identify elements in the Bloomreach Content user interface, configure the context parameter output-wicketpaths in your project's conf/context.xml file:

<Parameter name="output-wicketpaths" value="true"/>

This setting adds a wicketpath attribute to each element that corresponds to a Wicket component. The wicketpath attribute provides a stable way to locate elements in the UI for automated testing.

Create a Selenium Test Case Using Selenium IDE

To use the Selenium IDE for Firefox to create test cases, you need to access the wicketpath attribute easily. You can achieve this by adding a user extension to Selenium IDE.

1. Create the Extension

  1. Create a folder named wicketPathLocatorBuilder.
  2. Inside this folder, create a file called user-extension.js.
  3. Add the following code to user-extension.js:
LocatorBuilders.add('wicketpath', function(e) { this.log.debug("wicketpath: e=" + e); if (e.attributes && e.hasAttribute("wicketpath")) { this.log.info("found attribute " + e.getAttribute("wicketpath")); return "//" + this.xpathHtmlElement(e.nodeName.toLowerCase()) + "[@wicketpath=" + this.attributeValue(e.getAttribute("wicketpath")) + "]"; } return null; }); LocatorBuilders.order.unshift(LocatorBuilders.order.pop());

2. Install and Configure Selenium IDE

  1. Install the Selenium IDE plugin for Firefox from seleniumhq.org/download.
  2. Open Selenium IDE.
  3. Navigate to Options > Options.
  4. In the Selenium Core extensions input field, enter the path to the user-extension.js file you created.
  5. Restart Firefox to apply the changes.

3. Record a Test

You can now record tests by interacting with the UI—click elements or right-click to insert additional commands. For reliable execution, insert a waitForText command before a click command when needed.

The following screenshot shows an example of recorded commands in Selenium IDE for Bloomreach Content:

Selenium IDE showing recorded commands for Hippo CMS test

Share Feedback
Page: /build/development-tools/create-a-selenium-test-case
Section: Build
Category *
Create a Selenium test case | Bloomreach Content Documentation