Quality Testing

Quality is delighting customers

Hi, i am new in selenium..Now only started to learn selenium..can any one please tell me, how to test web application using selenium with example.how to test the application. i need clarity with flow. please any one reply.

Views: 20

Reply to This

Replies to This Discussion

As per qa testing services, before start working on Selenium WebDriver, you need to set up below mentioned things

1. Install Java on your system
2. Install Eclipse IDE
3. Download the Selenium WebDriver Jar file

For Script Creation you can use below code step by step
Importing Packages
org.openqa.selenium
org.openqa.selenium.firefox.FirefoxDriver 

Instantiating objects and variables
WebDriver driver = new FirefoxDriver();

Launching a Browser Session
driver.get(baseUrl);  

Get the Actual Page Title 
actualTitle = driver.getTitle(); 

Compare the Expected and Actual Values

Terminating a Browser Session
driver.close();

Running the TestOn Eclipse's menu bar click Run > Run.

Locating GUI ElementsInstantiating
Web ElementsWebElement element = driver.findelement(By.id(""));

Clicking on an Element
element.click();

typing values in input box
element.sendKeys("");

Sample program:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Script1 {
        public static void main(String[] args) {
                System.setProperty("webdriver.firefox.marionette","C:\\geckodriver.exe");
                WebDriver driver = new FirefoxDriver();
                String baseUrl = "http://testing.com";       
                String expectedTitle = "Welcome: testers";       
                String actualTitle = "";       
                driver.get(baseUrl);       
                actualTitle = driver.getTitle();       
                if (actualTitle.contentEquals(expectedTitle)){           
                        System.out.println("Passed!");       
                }
               else {
                       System.out.println("Failed");
                }
                driver.close();
           }
}

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service