Running Selenium Webdriver Scripts in JMeter

Prerequisites Download the latest version of JMeter (I am using 3.0 r1743807) Download jmeter-plugins-manager-0.5.jar file and put it into lib/ext directory, then restart JMeter. http://jmeter-plugins.org/downloads/all/#Latest-Stable-Release Let’s get started Install the add ons using the JMeter plugin manager. Create a new JMeter Project Add a User Thread Group Add a Webdriver Sampler Add the Chrome Driver […]

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 […]

Webdriver FluentWait

public Wait wait; WebDriver driver = new FirefoxDriver(); wait = new FluentWait(driver) .withTimeout(360, TimeUnit.SECONDS) .pollingEvery(5, TimeUnit.SECONDS) .ignoring(NoSuchElementException.class); public WebElement fluentWait(final By locator) { WebElement foo = wait.until( new Function() { public WebElement apply(WebDriver driver) { return driver.findElement(locator); } } ); return foo; } public WebElement webElement(final By by) { return wait.until(ExpectedConditions.presenceOfElementLocated(by)); } public WebElement webElementVisible(final […]

checkCondition

public void checkCondition(boolean condition, String message) throws IOException { try { assertTrue(condition); System.out.println(message); } catch (AssertionError e) { message = message.contains(“is displayed”) ? message.replace(“is displayed”, “is not displayed”) : message.contains(“is disabled”) ? message.replace(“is disabled”, “is not disabled”) : message.contains(“is enabled”) ? message.replace(“is enabled”, “is not enabled”) : message.contains(“is not enabled”) ? message.replace(“is not enabled”, “is […]

Link

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output

The Automation scripts fail to run on the latest Firefox version 38.0.5. The error is “Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output” Resolving the issue: Update the selenium jar file to selenium-server-standalone-2.46.0.jar. The new version of firefox 38.0.5 is not supporting old jars of selenium. Download both […]