Hello, Guys welcome to http://www.seleniumlabs.in/ let me introduce myself to you.
I am Prosenjit Majumder working professional in
a beautiful city Bangalore India. I basically hail from City Of Joy, Kolkata.
I have passion towards automation testing since
last 6-7 years I started with Selenium then I got chance to work with other
tools like Maven, Ant, Git, GitHub, Jenkins, Sikuli etc.
Today let us see some of the basic concepts of
Automation Testing:
Q1-What is Automation Testing
Answer- When you talk about Software testing or Quality
assurance of any product it means we have to deliver our application bug free
it means no defect in our application. In order to achieve quality we perform
testing in our application it means we perform several test case it can be
functional test cases and nonfunctional test cases also.
In order to save our time and resource we can automate manual
test cases, which save human effort and time as well.
Scenario – If we need to test same scenario 100 times manually
and each time we are checking the same result then better to automate this test
case and run it number of times and verify the result.
We have different tools available in the market, which gives us
the liberty to automate our application
Q2- When Automation testing should be
performed?
Answer- We can perform automation testing in our day to day
testing activities it means when we have to execute some test case on regular
basics then better to automate that test cases
Majorly we perform automation testing for regression testing,
smoke testing and sanity testing as well.
Scenario- If you have 50 scenario that you have to execute on
daily basis and you will be testing the same scenario for next couple of releases
as well then manually running these test cases will be tedious task so here you
can adopt automation testing.
Q3-Which test case cannot be automated?
Answer-
1-This is very important and interesting question as well that
which test cases cannot be automated, my answer is you should avoid test cases
which is changes very frequently it means even if you will automate that test
case next time it will fail because application feature will change so better
to choose test case which is stable.
2- We should not
automate test cases which has manual interaction like enter authorization code,
capcha code etc.
Selenium introduction
Answer- Selenium is Open source Web Automation tool which was designed by Thought Works in 2004, It started by Selenium IDE then Selenium RC which is also known as Selenium 1 then Selenium Web driver which is also known as Selenium 2 Best selenium Training Institute in Bangalore
Answer- Selenium is Open source Web Automation tool which was designed by Thought Works in 2004, It started by Selenium IDE then Selenium RC which is also known as Selenium 1 then Selenium Web driver which is also known as Selenium 2 Best selenium Training Institute in Bangalore
Selenium is very
popular now days because of many reasons
· It is open source
tool, which means we do not have to purchase any license for this. We can download
from their officially website and we can use.
· It support many
languages like Java, Java Script, C#, Python, Ruby etc.
· We can perform cross
browser testing as well. Selenium Webdriver support almost all browser which
their latest version like Firefox, Chrome, IE, Safari, Opera etc.
· It support the entire
platform like Windows, UNIX, Linux, Apple etc.
· Recently Selenium has
introduced mobile testing as well, now we can automate Android testing using
Selendroid, IPhone testing using appium and many more.
· Selenium having
compatibility with many tools well some example are AutoIT, Jenkins, Sikuli,
Testng, Junit etc.
Browser methods in WebDriver
Web Driver, The main interface to use for testing, which represents an idealised web browser. The methods in this class fall into three categories:
Key methods are get(String), which is used to load a new web page, and the various methods similar to findElement(By), which is used to find WebElements. In this post we are going to learn browser controlling methods.
- Control of the browser itself
- Selection of Web Elements
- Debugging aids
get
Usage
1
2
3
4
5
6
7
8
9
10
| //Initialising driver WebDriver driver = new FirefoxDriver(); //setting timeout for page load driver.manage().timeouts().pageLoadTimeout( 20 , TimeUnit.SECONDS); //Call Url in get method //or
|
getCurrentUrl
Usage
1
2
3
| //Getting current url loaded in browser & comparing with expected url String pageURL = driver.getCurrentUrl();
|
getTitle
Usage
1
2
3
| //Getting current page title loaded in browser & comparing with expected title String pageTitle = driver.getTitle(); Assert.assertEquals(pageTitle, "Google" );
|
getPageSource
Usage
1
2
| //get the current page source String pageSource = driver.getPageSource();
|
close
Usage
1
2
| //Close the current window driver.close();
|
quit
Usage
1
2
| //Quit the current driver session / close all windows associated with driver driver.quit();
|
Different Types of Locators to identify UI elements
Selenium uses different types of locators to identify the UI elements on the page.
The following is the list of locators based on the priority and recommendations to use:
1. ID
2. Name
3. Class Name
4. Link
5. CSS
6. XPath
i.e. Theoretically, you have to follow the below steps while finding the Locator for the selected UI element:
Why different types of locators are used instead of having only one kind of locator to identify the UI elements ?
While building the application code, it is seen as a good practice to make sure that every element you need to interact with has an ID attribute and a Name attribute. Unfortunately, developers may not have provided ID or Name attributes to some elements in your application. So identifying those kind of elements may not be possible if we don't use the other type of locators like XPath or CSS selector locators. The following is the list of locators based on the priority and recommendations to use:
1. ID
2. Name
3. Class Name
4. Link
5. CSS
6. XPath
i.e. Theoretically, you have to follow the below steps while finding the Locator for the selected UI element:
- Locate the UI element by using its Unique ID else you have to go to the next step
- Locate the UI element by using its Unique Name else you have to go to the next step
- Locate the UI element by using its Unique Class Name else you have to go to the next step
- Locate the UI element by using its Unique Link else you have to go to the next step
- Locate the UI element by using CSS selector locator else you have to go the next step
- Locate the UI element by using its XPath locator
Practically, most of the people will try to locate the UI element using a unique ID. If unique ID value is not available, they
will use CSS selector locator followed by XPath locator.
4) This is most informative and also this post most user friendly and super navigation to all posts. Thank you so much for giving this information to me.selenium training in bangalore
ReplyDelete