20 January, 2015

What is 'Cross Browser Testing' and why do we need it?

'Cross Browser testing' is a type of functional test to check that your application works as expected in different browsers.
Below are some of the main reasons to perform Cross Browser Testing
  • Font size mismatch in different browsers.
  • JavaScript implementation can be different.
  • Some browser still not supporting HTML5.
  • Page alignment  and div size issue.
  • Image orientation.
  • Compatibility issues with OS. 

To execute the Test-cases with different browsers in the same machine at the same time we can integrate frameworks like Junit,TestNG with Selenium Web-driver.

How the name 'Selenium' came ?

An Automated Testing framework which was popular before Selenium was 'QTP'.
QTP was developed by 'Mercury Interactive' and later acquired by 'HP'.
Since Selenium is a well known Antidote for Mercury poisoning, this new Testing tool got his name to be 'Selenium'

What is 'Same Origin Policy' in Selenium?

Lets Say, for a website 'www.google.com' the HTML code uses a JavaScript Program called 'xyz.js'.
Because of same origin policy the 'xyz.js' file can access pages only from Google site. i.e Same domain and not from the other domain site like Yahoo,ebay,etc.
'Same Origin Policy' does not allow JavaScript code from accessing elements from other domain where it was Launched.
A JavaScript program can only access pages on the same domain where it belongs it cannot access pages from different domains.

09 January, 2015

What is the Difference between getwindowhandles() and getwindowhandle() in Selenium?

getwindowhandles() : It is used to get the address of all open browser tabs. It's return type is iterator<string>
getwindowhandle() : It is used to get the address of the current browser tab. It's return type is string.

What is the Difference between'/' and '//' in Xpath?

Single Slash  '/' : It is used to create Xpath with Absolute path.
Double Slash '//': It is used to create Xpath with Relative path.

What is "Headless Browser" ?

1. A headless Browser is a Web Browser without a GUI, In other words it is a piece of software that access web-pages but doesn't  show them to any human being.
2. They are actually used to provide content of web-pages to other programs.
3. Headless Browser can used for below mentioned reasons,
  •   How wide the page would appear for  a user.
  •   What color of the Text would be?
  •   The font family used.
  •   What the x/y coordinates of an object is  and many more.
Basically it understands web-pages like a browser.

3. 'Phantomjs' is one of the example of the Headless Browser.