Cross Browser Testing using Selenium


Cross Browser Testing using Selenium
> Using Selenium WebDriver nosotros tin execute Test cases against dissimilar browsers.

> Using Element Locators, Webdriver methods together with programmatic statements (Java or whatever other supported language) nosotros tin practise Test cases.

> Element Locators, WebDriver Methods together with Programmatic Statements are mutual for all browsers (Ex: Firefox, IE together with Chrome etc...)

Note: Browser driver entirely varies from i Browser to another.

Note 2: We require to download IE, Chrome drivers together with ready driver path, only for Firefox browser no require to download browser driver.

Note 3: We tin download IE together with Chrome drivers from seleniumhq.org website.
------------------------------------------
Cross Browser Testing using Selenium WebDriver.
Manual Test Case: Verify Gmail Login Functionality
Steps:
i) Launch the Browser
ii) Enter www.gmail.com url inward the Browser Address bar Or Navigate to gmail abode page.
iii) Enter Email
iv) Click "Next" Button
v) Enter Password
vi) Click "Sign in" Button

Verification: Capture URL afterwards Login together with compare if the "inbox" text is available or not?
-------------------------------
a) Selenium Test Case for Firefox Browser
public flat VerifyLogin {

public static void main(String[] args) {

WebDriver driver = novel FirefoxDriver();   

driver.get("https:/www.gmail.com");   
driver.findElement(By.id("Email")).sendKeys("gcrindia");
driver.findElement(By.id("next")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("Passwd")).sendKeys("gcreddy123");
driver.findElement(By.id("signIn")).click();
String url = driver.getCurrentUrl();
   
    if (url.contains("inbox")){
    System.out.println("Test Passed");
    }
    else {
    System.out.println("Test Failed");   
    }
    driver.close();
    }
    }
------------------------------------------------
b) Selenium Test Case for Google Chrome Browser
public flat VerifyLogin {

public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
WebDriver driver = novel ChromeDriver();   

driver.get("https:/www.gmail.com");   
driver.findElement(By.id("Email")).sendKeys("gcrindia");
driver.findElement(By.id("next")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("Passwd")).sendKeys("gcreddy123");
driver.findElement(By.id("signIn")).click();
String url = driver.getCurrentUrl();
   
    if (url.contains("inbox")){
    System.out.println("Test Passed");
    }
    else {
    System.out.println("Test Failed");   
    }
    driver.close();
    }
    }
--------------------------------------------------
c) Selenium Test Case for Internet Explorer Browser
public flat VerifyLogin {

public static void main(String[] args) {

System.setProperty("webdriver.ie.driver", "E:/IEDriverServer.exe");
WebDriver driver = novel InternetExplorerDriver();   

driver.get("https:/www.gmail.com");   
driver.findElement(By.id("Email")).sendKeys("gcrindia");
driver.findElement(By.id("next")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("Passwd")).sendKeys("gcreddy123");
driver.findElement(By.id("signIn")).click();
String url = driver.getCurrentUrl();
   
    if (url.contains("inbox")){
    System.out.println("Test Passed");
    }
    else {
    System.out.println("Test Failed");   
    }
    driver.close();
    }
    }
----------------------------------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post