Tags » WebDriver

Waiting for AJAX calls in WebDriver C#

I was trying to work out how to wait for AJAX calls to complete in C# WebDriver before continuing a test.

Whilst I believe that your UI should visually indicate that AJAX activity is occurring (such as a spinner) and in this case you should be able to wait until such an indicator changes, if you don’t have a visual indicator and you use JQuery for your AJAX calls, you can use a JavaScript call to… 129 more words

Automated Testing

Waiting between tests

A short code to take care of waiting-sleeping between tests:
def sleepForNSeconds(int n) {
    def originalMilliseconds = System.currentTimeMillis()
    waitFor(n + 1, 0.5) {
        (System.currentTimeMillis() - originalMilliseconds) > (n * 1000) 
    }
}
Selenium WebDriver

How to use log4j more efficiently in selenium webdriver testing framework

Log4j is the most required logging mechanism for any webdriver testing framework.

We can have a single class, where we can initialize log4j and the invoke a method from that class to get the instance of log4j in each of the other classes. 446 more words

Selenium WebDriver

Essence of the Selenium Webdriver

WebDriver is a tool that allows you to write code, in a number of languages, that automates a browser and allows you to interrogate what is rendered by the browser. 4,221 more words

Manual Testing

Running Gradle script on Bamboo

I came across this issue while running Geb tests using Gradle build script on Bamboo CI.

The firefox browser would fail with error:

” org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.

58 more words
Selenium WebDriver

Implicit wait Vs. Explicit wait

Implicit wait

 WebDriver driver = new FirefoxDriver();
 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);  

Implicit waits are basically your way of telling WebDriver the latency that you want to see if specified web element is not present that WebDriver looking for. 195 more words

Selenium WebDriver

Handling Modal Window in Selenium WebDriver

This would work for all browsers (FF, Chrome, IE).

 
public class ModalDialog {

        public static void main(String[] args) throws InterruptedException {
            // TODO Auto-generated method stub
            WebDriver driver = new InternetExplorerDriver();
            //WebDriver driver = new FirefoxDriver();
            driver.get("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm");
            String parent = driver.getWindowHandle();
            WebDriverWait wait = new WebDriverWait(driver, 10);
            WebElement push_to_create = wait.until(ExpectedConditions
                    .elementToBeClickable(By
                            .cssSelector("input")));
            push_to_create.click();
            waitForWindow(driver);
            switchToModalDialog(driver, parent);

        }

        public static void waitForWindow(WebDriver driver)
                throws InterruptedException {
            //wait until number of window handles become 2 or until 6 seconds are completed. 60 more words
Selenium WebDriver