Tutorial
Test Automation Waits
Automation Waits in Selenium are a very important part of automation that everyone should understand. How do you pause a test to wait for some element to load. Then there is the issue of AJax web pages that load data after
the page as responded.
Thread Wait - Simply stop the test from execution. You can thread wait X milliseconds, this is not the best way to wait for pages to load.
WebDriver Wait - Same as Implicit wait which is the same as Thread Wait
Explicit Wait - Need to setup the Explicit wait with a call to WebDriverWait. Then you apply the WebDriverWait to a DOM Element
Implicit Wait - Same as WebDriver wait.
Fluent Wait - Used for web pages with Ajax. Fluent wait is similar to Explicit wait but with polling.
Data Driven Tests
Data driven tests are one of the most important patterns in Selenium automation. TestNG provides an easy way to pass data to any test thru the @DataPrivider. Use the DataProvider to pass in parameters like: OS, Browser, and Platform.
This allows a single test to be executed quickly with different environments and browsers.
EXAMPLE:
@Test(dataProvider = "sTestBaseTestNGDeclarationDataProvider")
public void yahooTest(String browser , String browserVersion, String platform, String osVersion, String remote, String baseURL) {
// Test tests
}
BichroMate Selenium webDriver Creation
THere is one function call to create any webDrive. From Local web driver, Selenium Grid, Browser Stack, and SauceLabs. In the following example
driver and sampleWebDriver are created before the test is called.
driver = sampleWebDriver.createBrowserWebDriver (('local','selenium grid', 'saucelabs', 'BrowserStack'),
'browser version', 'platform','platform version','browser name','Description');
EXAMPLE:
driver = sampleWebDriver.createBrowserWebDriver ("BrowserStack","58",
"Windows","7","FireFox","Sample Web driver test");
Guru 99 tutorials
Guru99 is another Selenium tutorial site. Here you learn by practice. We make tons of efforts to take boredom out of learning and make education a fun experience.
Read more