Saturday 23 June 2012

Page load timeout is implemented in Selenium/WebDriver

Finally, page load time out is implemented in WebDriver, So IE9 hang issue with pages having multiple frames will not be a concern.:) It works with get and click method.
      We can set the page loadtime in webdriver.Suppose if we want facebook to be loaded within 60 sec then add below statement in your code


driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.get("http://facebook.com/");

WebElement myElem = findElement("Your code to Find Element");
try{
myElem.click()
}catch(Exception e){
sysout("Eating the Exception");
}

If facebook failed to load within 60sec then script will fail.

If you do not want script to fail in the above condition, put the code in try catch block and eat the exception. 

Make sure you know the timing of your page load or after page load wait for the elements to appear. It may make your test scripts flaky.

Thanks!!

Monday 18 June 2012

Selenium 2.0 / (Selenium + Web Driver)

Today we will talk about the need of Selenium 2.0 which is a result of merger between Selenium 1.0 & Web Driver. Selenium is capable Web Browser automation tool then why merged with Web Driver, What is web driver , what benefits it will bring to existing Selenium. Lets see those 1/1.


What is Web Driver?
        Web Driver is a set of API developed by Open Source team which can be used to automate browser tasks. Like Selenium, it can be hooked by many language bindings (Java , C#, Python etc). It is like the end user, simulates the user action on the html of the browser. 


Benefits of Web Driver
        1) Web Driver is built with the approach of Object Oriented.
        2) This means code re usability, ease to use and complexity of numbers of methods are very less.
        3) Every browser it supports, supported natively.This means there will not be java script execution for each action on HTML elements in the web page. 
        4) The above is a breakthrough reason for adopting Web Driver.

     Selenium 1.0 merged with Web Driver to create Selenium 2.0 through which user can use the benefits of Selenium and Web Driver both. Where as Selenium uses Java Script as the simulating user performing action engine, Web Driver uses native browser mechanism to perform the actions. In some situations, where underlying browser can not be used for native events, it takes help from Selenium..

A example to detail the above will be -: Lets say a user wants to find some element using XPATH in Internet Explorer. But IE does not support XPATH natively, so what should web driver do in this case, It takes help from Selenium, using java script method, finds the element.

Then what does it mean by natively support. It means in simple terms, if user wants to find a HTML element having id="myElement" then using Web Driver you can simply ask the used browser that give me the web element whose id="myElement" in this page. And browser obeys to this and give it back to Web Driver.

In the next post, I will be detailing about the Web Driver API and how to use it.

Thanks!!
         







Tuesday 12 June 2012

Monday 11 June 2012

What i understand about Selenium?


Hello All,

It is my second post in the blog, Neither I am a good writer or a speaker or a good blogger. I created this blog just to share my ideas/learning with all of you.

Today, lets talk about mercury killer -:) automation tool oops, browser automation tool. Yes, It is SELENIUM.

I have been working with Selenium for quite some time, found it very powerful tool to automate browser tasks or automate your AUT.

Selenium is not an fully automation tool, but a browser automation tool. Lets get it straight, Selenium as tool can and only can automate anything embedded in side a HTML tag.

Lets talk about how it works in very simple term. I have experienced many basic questions related to Selenium, will try to share those experiences below....

1) Selenium is a browser automation tool.
2) The above point makes it clear that, Selenium can work with elements which are enclosed with a html tags.
3) All whatever you see in a webpage can be represented as a     Web Element by Selenium.
3) How does it actually work?
       a) First IDENTIFY Web Element.
       b) Second Act/Perform action Web Element.
4) Verify the state of your application by comparing actual/expected results.
5) Give pass/fail status based on the result verification.

For the starters, Wait for the new coming post.... be tuned...We will see many new things about Selenium.


Happy Automating!!

God Bless You All. 







Related Posts

Related Posts...