How to select an option from “AutoComplete” text field

  • 04
    Sep

    How to select an option from “AutoComplete” text field

    Following code snippet demonstrates how to select an option from “AutoComplete” text field import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class...

    Read More
  • 04
    Sep

    How to automate with “ExpectedConditions” in Selenium WebDriver

    Return type for “ExpectedConditions.xxxx()” is generally falls under following categories: Alert Boolean WebElement List WebDriver Object Following code snippet demonstrates usage and validation based on return type. (ExpectedCondition testing...

    Read More
  • 04
    Sep

    re-run failed test case with Selenium TestNG framework

    In order to re-run failed test cases, TestNG provides “IRetryAnalyzer” interface, which needs to be implemented for “retry()” Following code snippet demonstrates how to implement this interface and re-run...

    Read More
  • 04
    Sep

    kill a process via java program

    Following code snippet can be used to kill all running instances of Internet Explorer import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class RerunAttemp { @Test public void...

    Read More
  • 03
    Sep

    find broken links on a webpage

    Following code snippet can be used to details of link and their working / not working (broken) details on a page package practice; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL;...

    Read More
  • 03
    Sep

    solution to “unable to find valid certification path to requested target” in java

    How to import certificate offline Go to URL in your firefox browser, click on HTTPS certificate chain (next to URL address). Click “more info” > “security” > “show certificate”...

    Read More
  • 03
    Sep

    Running a TestNG case multiple time in a batch of two

    In order to execute a script via two threads and three times total, we can use following code snippet import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.Test; public class...

    Read More
  • 03
    Sep

    dependsOnMethods() example in TestNG

    following code snippet shows example of dependsOnMethods function import org.testng.annotations.Test; public class TestNGExample { @Test(groups = { “Automation” }) public void driver() { System.out.println(“Initialize Browser”); } @Test(dependsOnMethods = {...

    Read More
  • 03
    Sep

    Resize window with Selenium WebDriver

    Following code snippet can be used to resize a browser window in selenium import org.openqa.selenium.Dimension;import org.openqa.selenium.WebDriver;import org.openqa.selenium.firefox.FirefoxDriver;import org.testng.annotations.Test; public class testJavaScriptErrors { @Testpublic void testForFramesCount() throws InterruptedException {WebDriver driver...

    Read More
  • 03
    Sep

    Functions to execute javascript during WebDriver script execution

    Following generic code can be used to execute a JavaScript with Selenium WebdDriver import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class testJavaScriptErrors { @Test public void testForFramesCount()...

    Read More