Convert String to Proper or Title case

public static String toTitleCase(String input) { final String ACTIONABLE_DELIMITERS = ” ‘-/”; // these cause the character following // to be capitalized StringBuilder sb = new StringBuilder(); boolean capNext = true; for (char c : input.toCharArray()) { c = (capNext) ? Character.toUpperCase(c) : Character.toLowerCase(c); sb.append(c); capNext = (ACTIONABLE_DELIMITERS.indexOf((int) c) >= 0); // explicit cast not […]

How to locate an element by Xpath with its dynamic title

Example: I have two images ImageHTMLCode some_date1 and some_date2 are generated dynamically. How to locate them using CSS locator ? click css=img[title*=’since’] : will not work because it won’t make difference between the two images. Here is the solution: If you want to click on the first try this : //IMG[contains(@title,’Critical since’)][1]

Validating the text from a text box using Selenium RC

Here is the html code input id=”qu” and the text in the text input box is Selenium Wiki. To validate the text from a text box using Selenium RC you will have to use the Selenium command selenium.getValue(). This will get the value in the location input id=”qu”. selenium.getValue(“//input[@id=’qu’]”) If you found this solution helpful […]