In this following article we are going to learn the basic Test Strategy(the way) to test a web site element using selenium web driver.
First , we need to know what selenium web driver does. Selenium web driver fully controls the a browser , get the web elements, get data, get all the actions. Selenium web driver is used for functional test automation (mostly data validation). It also provides consistency among different browsers. Web Driver uses a different underlying framework from Selenium’s javascript Selenium-Core. It also provides an alternative API with functionality not supported in Selenium-RC. WebDriver does not depend on a javascript core embedded within the browser, therefore it is able to avoid some long-running Selenium limitations.
Before starting, we have to determine what to test, what to automate.
A web site may have different type of elements(details in my previous post).
For a UI web element when we will attempt to test we need to think about the scopes by which we can see the element is full functional.
For that if we check
-An element is present in a proper place on the page
-A text is present on the page(with proper style).
OR both -A text is at a specific place on the page
-The element is rendered properly in popular browsers.
-The element is Image(if it has) is proper size as well as position
-The HTML is ok
-The backed functionality is ok.
If a text or an image is present on a page to any location, we can easily check that by verification (when contents are frequently changing). If contents ate fixed, we can use assert for specificity.
For Image specificity, we will use Xpath for all example, as it is most useful and commonly used. In Xpath, we don’t have to have a suitable id or name attribute for the element you wish to locate. We can use XPath to either locate the element in absolute terms (not advised), or relative to an element that does have an id or name attribute. XPath locators can also be used to specify elements via attributes other than id and name.
(Note : XPath is the language used for locating nodes in an XML document, we will post a different post on describing XPath)
For better understanding, lets say, we need to check for a combo UI element. We may think in following way,
-Is the combo is ok to see( people can click & see the items).
-Is all elements are listed properly( element data and order)
-Is any position element is selectable
-After selection, can user gets the data to work with
-Is the CSS is ok for the particular styled combo.
-Is the combo Name is proper
-Is the combo position is correct.
-If the combo items are coming from database, is that the data collection ok.
-if Ajax/JavaScript loads items, are they are ok
-If items comes from external source, the time that needed for loading the items is ok
-If there is any service associated with the elements, are they are coming in proper way.
This is just an example to way of thinking in web driver way. Incrementally I will provide that way for all popular web elements.
First , we need to know what selenium web driver does. Selenium web driver fully controls the a browser , get the web elements, get data, get all the actions. Selenium web driver is used for functional test automation (mostly data validation). It also provides consistency among different browsers. Web Driver uses a different underlying framework from Selenium’s javascript Selenium-Core. It also provides an alternative API with functionality not supported in Selenium-RC. WebDriver does not depend on a javascript core embedded within the browser, therefore it is able to avoid some long-running Selenium limitations.
Before starting, we have to determine what to test, what to automate.
A web site may have different type of elements(details in my previous post).
For a UI web element when we will attempt to test we need to think about the scopes by which we can see the element is full functional.
For that if we check
-An element is present in a proper place on the page
-A text is present on the page(with proper style).
OR both -A text is at a specific place on the page
-The element is rendered properly in popular browsers.
-The element is Image(if it has) is proper size as well as position
-The HTML is ok
-The backed functionality is ok.
If a text or an image is present on a page to any location, we can easily check that by verification (when contents are frequently changing). If contents ate fixed, we can use assert for specificity.
For Image specificity, we will use Xpath for all example, as it is most useful and commonly used. In Xpath, we don’t have to have a suitable id or name attribute for the element you wish to locate. We can use XPath to either locate the element in absolute terms (not advised), or relative to an element that does have an id or name attribute. XPath locators can also be used to specify elements via attributes other than id and name.
(Note : XPath is the language used for locating nodes in an XML document, we will post a different post on describing XPath)
For better understanding, lets say, we need to check for a combo UI element. We may think in following way,
-Is the combo is ok to see( people can click & see the items).
-Is all elements are listed properly( element data and order)
-Is any position element is selectable
-After selection, can user gets the data to work with
-Is the CSS is ok for the particular styled combo.
-Is the combo Name is proper
-Is the combo position is correct.
-If the combo items are coming from database, is that the data collection ok.
-if Ajax/JavaScript loads items, are they are ok
-If items comes from external source, the time that needed for loading the items is ok
-If there is any service associated with the elements, are they are coming in proper way.
This is just an example to way of thinking in web driver way. Incrementally I will provide that way for all popular web elements.
Really nice information on Browser Automation and specific strategy of doing automation
ReplyDeleteThanks god...:) please feel free to add your ideas.
Delete