Read a XML test data in Java

Here is the code to read the xml test data coded in Java. import; import; import; import; 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 […]

Highlight element with Selenium Webdriver

Here is the code to highlight the element using Selenium Webdriver. You will have to replace the driver.findElement to findElement. I have also give the example of using findElement. public WebElement findElement(By by) { WebElement elem = driver.findElement(by); if (driver instanceof JavascriptExecutor) { ((JavascriptExecutor) driver).executeScript(“arguments[0].style.border=’1px solid yellow'”, elem); } return elem; } public void type(By […]

waitForElementPresents method to check for multiple elements on a webpage

waitForElementPresents method is used to check for multiple elements on a webpage at one time. Java Selenium Webdriver. [code] public void waitForElementPresents(int i, By… by) throws InterruptedException, IOException { for (int second = 0; second <= i; second++) { if (second >= i) { takeScreenshot(); break; } if (areAllElementsPresent(by)) { for (By singleBy : by) […]


Setup Grid instance on a remote machine and executing the test script on the remote machine.

Requirements on your current system (System A) and remote system (System B) Download and Install Chrome browser Selenium Server Download version 2.33.0 from Chromedriver from Latest version of Java Version 7 download it from Installation on your current system (System A) and remote system (System B) Create a new folder “Selenium” in […]