Back to Browse

Selenium WebDriver Introduction

1.4K views
Jul 20, 2016
1:56:33

http://www.gcreddy.com/2016/07/selenium-webdriver-introduction.html Introduction to Selenium WebDriver, Selenium WebDriver Features, Drawbacks of Selenium WebDriver, Selenium WebDriver Environment Setup and Create first Selenium Test Case. Download and Install Java, download and extract Eclipse IDE and Configure WebDriver in Eclipse. Write first Selenium Test Case using Element Locators and WebDriver Commands. i Introduction to Selenium WebDriver ------------------------------------------ Selenium's Tool Suite Selenium IDE Selenium RC Selenium WebDriver Selenium Grid ------------------------------------------------- Selenium WebDriver In 2006, Selenium WebDriver was launched at Google. In 2008, the whole Selenium team decided to merge Selenium RC with Selenium WebDriver in order to form more powerful tool called Selenium 2.0 Selenium 1.0 + Selenium WebDriver = Selenium 2.0 Selenium 1.0 Selenium IDE + Selenium RC + Selenium Grid Selenium 2.0 Selenium IDE + Selenium RC + Selenium WebDriver + Selenium Grid Note: Now Selenium RC is only for maintenance Projects --------------------------------------------------------------------- Selenium WebDriver Features: Selenium WebDriver doesn't have IDE (Integrated Development Environment), only Programming Interface Using Element Locators and WebDriver Commands we create Test Cases Selenium WebDriver supports various Operating Environments Selenium WebDriver supports various Programming Environments to write Test Scripts/Programs. Selenium WebDriver supports various Browsers Selenium WebDriver supports various Testing Frameworks, It supports Batch Testing, Data Driven Testing, Database Testing and Parallel Test execution -------------------------------------------------------------- Drawbacks of Selenium WebDriver Selenium WebDriver supports only Web Applications It doesn't have IDE, so creating Test Cases takes more time and efforts. No reliable Technical support. No built in Result Reporting facility. Limited support for Image Testing No other tool integration with Selenium WebDriver for Test Management -------------------------------------------------------- ii Selenium WebDriver Environment Setup Steps: 1 Download and Install Java Software (jdk) - To create and execute programs (Test Scripts) 2 Download Eclipse IDE and Extract - Platform to write and execute Java Programs. 3 Download Selenium WebDriver Java Language binding from www.seleniumhq.org and Add WebDriver jar files to Java Project in Eclipse IDE. --------------------------------------------------------- WebDriver Environment Setup: Create Java Project Select Java Project in Eclipse IDE and right click Build path Configure build path Select Libraries tab Click "External jars" Browse path of selenium Webdriver jars Add -------------------------------------------------------- iii Write first Selenium Test Case Test Scenario / Manual Test Case Test Case Name: Verify Admin Login in gcrShop web portal Test Steps: 1 Launch the Browser 2 Navigate to "http://www.gcrit.com/build3/admin/" 3 Enter Username 4 Enter Password 5 Click "Login" Button Test Data: Username = admin Password = admin@123 Verification Point: Capture the URL after Login and compare with expected. Expected: http://www.gcrit.com/build3/admin/index.php Actual: Status: Pass/Fail -------------------------------------------------- Inspect Elements Username -Edit box- username (name locator value) - [email protected] (Input data/Test Data) Password -Edit box - password (name locator value) - Login - Button - tdb1 (id locator value) --------------------------- Element Locators - To identify/recognize/locate Elements WebDriver Commands - To perform Operations on Elements ------------------------------------------------- Write Selenium WebDriver Test case: WebDriver driver = new FirefoxDriver();//Launches Firefox Browser with Blank url driver.get("http://www.gcrit.com/build3/admin/"); driver.findElement(By.name("username")).sendKeys("admin"); driver.findElement(By.name("password")).sendKeys("admin@123"); driver.findElement(By.id("tdb1")).click(); String url = driver.getCurrentUrl(); if (url.equals("http://www.gcrit.com/build3/admin/index.php")){ System.out.println("Admin Login Successful - Passed"); } else { System.out.println("Admin Login Unsuccessful - Failed"); } driver.close(); } } --------------------------------------------------- String url = driver.getCurrentUrl(); if (url.equals("http://www.gcrit.com/build3/admin/index.php")){ } Or if ((driver.getCurrentUrl()).equals("http://www.gcrit.com/build3/admin/index.php")){ } --------------------------------------------------------

Download

0 formats

No download links available.

Selenium WebDriver Introduction | NatokHD