Thursday 12 September 2013

JXL And POI, which api is better and why

  •      jxl does not support  XLSX files
  •      jxl exerts less load on memory as compared to ApachePOI
  •      jxl doesn't support rich text formatting while ApachePOI does.
  •      jxl has not been maintained properly while ApachePOI is more up to date.
  •      Sample code on Apache POI is easily avaialble

Wednesday 11 September 2013

How to handle java script/error/exception alert using WebDriver

WebDriver would support handling js alerts using Alert interface.
         
          // Bring control on already opened alert
               Alert alert = driver.switchTo().alert();

          // Get the text/message of the alert or prompt
               alert.getText(); 
         
         // Click ok button of alert
              alert.accept();

         // Click Cancel button of alert
              alert.dismiss();

How to open Selenium IDE in Firefox

Selenium IDE can be opened in two way
  1.  Go to [View -> Side bar -> Selenium IDE]
  2.  Go to [Tools -> Selenium IDE]

What are the technical issues with Selenium

Limitation of Selenium are as follows -

  1.      Very difficult to find good documentation
  2.      We cannot run scripts from step as we can do in QTP. SO script generation takes a lot of time
  3.      WebDriver doesn’t support safari and mac (as of now).
  4.      No documentation for Selenium Grid
  5.      Difficult to generate reports.
  6.      Password encryption is not possible.

Tuesday 10 September 2013

QTP/UFT : Working with WebTable

QTP provides different methods to perform operation on WebTable.  This blog discusses about few of them -
How to check if  a WebTable exist
    msgbox Browser(…).page(…).webtable(…).exist ‘returns true/false
 How to find number of rows in WebTable
msgbox Browser(“").Page("").WebTable(“").RowCount  ‘ returns count of row in a           WebTable

How to find number of columns in a web table
    msgbox Browser("").Page("").WebTable(“").ColumnCount(1) ‘return column count in a 1st   
    row of WebTable

How to read data from a Cell WebTable
    msgbox Browser("").Page("").WebTable(“").GetCellData(row,column)
  ‘Where row & column specifies row number & column number of a Cell
How to find object using  childObject on a WebTable
 Set oDesc=Description.Create
 oDesc("micclass").value= WebCheckBox
 set oChild=Browser("").Page("").WebTable(“").ChildObjects(oDesc)
 msgbox oChild.count

How read data from WebTable using ChildItemCount and childItem
     oChild=Browser("").Page("").WebTable(“).ChildItemCount(row,col,” WebCheckBox”)
    If oChild >0
    Childitem will return object oftype defined in arguments for childitem
    Set cItem = Browser("").Page("").WebTable(“").ChildItem(row,col, WebCheckBox,0)
    If (strobjType = "Link" or strobjType ="WebEdit") Then
       cItem.Click
    ElseIf(stobjType = "WebCheckBox") Then
       cItem.Set "ON"
    End If