Forum Discussion

shilpi_agarwal's avatar
shilpi_agarwal
Contributor
9 years ago

problem when reading blank from excel file

 

Script is reading first two records correctly but when blank appears on excel file, script does not read and throw an error-

Vb-Script Run Time error

Type Mismatch: 'uName.Keys'

 

This is my excel file 

 

 following is my script-

Set Driver = DDT.ExcelDriver("D:\TCProject\GUITestingAutomation\Stores\TestSheet.xls", "Sheet1")

rec = 0
While Not Driver.EOF()
rec = rec + 1
Call uname.Keys("^a")
Call uname.Keys("[Clear]")
Call uname.Keys(Driver.Value(0))
Call uname.Keys("[Tab]")
Call pwd.Keys("^a")
Call pwd.Keys("[Clear]")
Call pwd.Keys(Driver.Value(1))
loginFrame.btnLogin.ClickButton
if rec = 2 then
'Call aqObject.CheckProperty(Aliases.prowin.dlgMessage.Static, "WndCaption", cmpEqual, Driver.Value(2), True)
strCaption = Aliases.prowin.dlgMessage.Static.WndCaption
If strCaption <> Driver.Value(2) Then
Log.Error("Property value " & strCaption & " does not match data value " & Driver.Value(2))
End If
End if
Call Driver.Next()
Wend

 

Please suggest.

  • I would suggest, also, wrapping your calls to the cell data with aqConvert.VarToStr(). That will ensure that a "blank" excel field will actually return a "blank" rather than a NULL value. 

  • We have never had luck with blank spaces in Excel.  If there's not going to be real data in all the cells, then we use a period and check for 

     

    If not equal to '.'

    instead of if not blank

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      I would suggest, also, wrapping your calls to the cell data with aqConvert.VarToStr(). That will ensure that a "blank" excel field will actually return a "blank" rather than a NULL value.