Forum Discussion
Hi, Anil.
I've reproduced the behavior you described, and as far as I can see, it is caused by the fact that an array element you are trying to use as the needed drop-down list item (for example, the arrStr(3) item) contains a non-printable character at the end. In fact, you add this character manually in your code in the ReadDataFromExcel function:
Function ReadDataFromExcel()
Set Excel = Sys.OleObject("Excel.Application")
Call Excel.Workbooks.Open("E:\Anil-Backup\Test Complete\Projects_Old\Codding\Excel Files\Login_details.xls")
Delay 1000
log.Message(Excel)
For i = 1 to 2
s = ""
For j = 1 to 6
s = s + VarToString(Excel.Cells(i, j)) + Chr(13) + Chr(10) + ":" ‘<= Right here
Next
Log.Message "Row: " + VarToString(i), s
Next
ReadDataFromExcel = s
'Closes the driver
Call Excel.Workbooks.Close
End Function
Is it necessary to add it to the generated string?
In truth, when I removed this code segment from the ReadDataFromExcel function, everything started working fine.
So, if it is not based on a principle, I suggest that you use the following code:
Sub adprty1
Dim iexplore
Dim w5
Dim p
Dim xlSheet
Delay 3000
Set iexplore = Sys.Process("iexplore", 2).Page("http://qaserver/Default.asp").document.frames.Frame("mainFrame").document.all
iexplore.Item("btnAddProperty").click
Delay 3000
Log.message("You clicked on Add Property button...!")
Dim str, arrStr
str = ReadDataFromExcel()
arrStr = Split(str,":")
iexplore.Item("textPropName").Value = arrStr(0)
iexplore.Item("PropertyCode").Value = arrStr(1)
iexplore.Item("textareaPlotAddress").Value = arrStr(2)
iexplore.Item("cboCertifyingCompany").ClickItem(arrStr(3)) ‘<= recommendations from my previous post
iexplore.Item("textPinCode").value = arrStr(4)
iexplore.Item("cboCountries").ClickItem(arrStr(5)) ‘<=recommendations from my previous post
End Sub
Function ReadDataFromExcel()
Set Excel = Sys.OleObject("Excel.Application")
Call Excel.Workbooks.Open("E:\Anil-Backup\Test Complete\Projects_Old\Codding\Excel Files\Login_details.xls")
Delay 1000
log.Message(Excel)
For i = 1 to 2
s = ""
For j = 1 to 6
s = s + VarToString(Excel.Cells(i, j)) + ":" ‘<= recommendations from this post
Next
Log.Message "Row: " + VarToString(i), s
Next
ReadDataFromExcel = s
'Closes the driver
Call Excel.Workbooks.Close
End Function
Does it work now?