Last 5 and 6 November 2011 was the Saigon MDC 2011(http://www.mobiledevcamp-vn.org/?lang=en). Over I took a training session on android webdriver automation test training session. That training's session slides are attached here. If you missed that training session then also I hope this slide will help your learning invention . Cheers !
5 Comments
Its pretty important. try the following, you will be able to do this !
public class WebDriverTestClass { public static void main(String a[]) throws InterruptedException { try { WebDriver driver = new FirefoxDriver(); // Go to Google Home Page26 driver.get("http://www.google.com"); // Look for search textbox and enter search term there WebElement searchBox = driver.findElement(By.name("q")); searchBox.sendKeys("WebDriver API"); // Click on 'Search'33 WebElement searchButton = driver.findElement(By.name("btnG")); searchButton.click(); // Not required or recommended any where, but just wait for the last37 // click() // operation to get completed fine Thread.sleep(2000); // to return the url System.out.println("What's the current Url: "+ driver.getCurrentUrl()); // if you wish to take screenshot of this page, File scrFile = ((TakesScreenshot) driver) .getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File( "c:\\screenshot\\googlesearch-webdriverapi.png")); // Close the driver, once you're done driver.close(); } catch (Exception e) {53 e.printStackTrace(); // For debugging purposes54 } } } |
AuthorI am Masud Parvez. Working as IT Senior Project Manager for RMIT University. Previously I built and run a distributed Test Center. My success was to turn that in to one of the most successful business units of the company. Categories
All
|