Read a XML test data in Java

Here is the code to read the xml test data coded in Java.

import java.util.Enumeration;
import java.util.Properties;

public class ReadXmlData {
public String value;

public String data(String node) {
try {
File file = new File("../TestData.xml"); // XML file path
FileInputStream fileInput = new FileInputStream(file);
Properties properties = new Properties();
Enumeration enuKeys = properties.keys();
while (enuKeys.hasMoreElements()) {
if (((String) enuKeys.nextElement()).contains(node)) {
value = properties.getProperty(node);
} catch (FileNotFoundException e) {
} catch (IOException e) {
return value;

Video recording the Selenium Automation scripts

Its been a long time since I have posted an article, been very busy with work. So, here is an article about video recording the automation scripts that you running.

I have used a third part library called “” to record the testing. This is done when there are issues. The recorded video is attached to the Jira ticket for the developer to see the steps and also know the issue.

Here are the libraries you need import.
[gist id=5719121]

For the video to work make sure you use both the startRecording and stopRecording methods.

Useful links:

Solving Compound class names are not supported – error

Here is a simple solution to resolve the error: “Compound class names are not supported. Consider searching for one class name and filtering the results.”.
Say you have a div class something link this – div class=”m-table-rap m-tab-body-rap tab-body-m” and want to use xpath to identify the element you will get the error “Compound class names are not supported. Consider searching for one class name and filtering the results.”
To resolve the issue you will need to use cssSelector
The cssSelector will be “”

Using type command in advanced selenium webdriver – Actions class

Here is the code that you can use to execute the type command when using Actions class
public void actionType(By by, String value) {
new Actions(driver).moveToElement(
driver.findElement(by)).click().sendKeys(Keys.chord(Keys.CONTROL, "a"), value).perform();

This will clear the text field and then add the value you want.
If you want to just clear the exiting text use the following command.
new Actions(driver).moveToElement(
driver.findElement(by)).click().sendKeys(Keys.chord(Keys.CONTROL, "a"), "").perform();

You will need to import org.openqa.selenium.Keys;