Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel_Datasheet Looping problem
#1
Not Solved
Hi everyone! I'm new in this forum and a very avid Qtp learner. I been trying to learn create a framework here it's working fine except my Excel loop is not working, it's just keep overwriting on the same row and column. Please anypne can help me out .


Code:
Environment.LoadFromFile"C:\Documents and Settings\Administrator\My Documents\Survey_Monkey.xml"
Executefile Environment.value("Env_Functionpath")
Repositoriescollection.Add Environment.value("Env_objrep")

i=2
For i = 2 to 4

set objExcel=createobject("Excel.application")
objExcel.workbooks.open Environment.value("Excel_path")
objExcel.application.visible=True
set objExcelsheet=objExcel.activeworkbook.worksheets("sheet1")

username=Fnrandomusername
Password=Environment.value("Env_Password")
Retype_password=Environment.value("Retype_Password")
Email_id=FnrandomEmailid


Fnlaunch_application
wait 2
Browser("Sign up for a FREE SurveyMonke").Page("Sign up for a FREE SurveyMonke").WebEdit("UserName").Set username
wait 3

Browser("Sign up for a FREE SurveyMonke").Page("Sign up for a FREE SurveyMonke").WebEdit("Password").Set Password
wait 3

Browser("Sign up for a FREE SurveyMonke").Page("Sign up for a FREE SurveyMonke").WebEdit("PassConfirm").Set Retype_password

Browser("Sign up for a FREE SurveyMonke").Page("Sign up for a FREE SurveyMonke").WebEdit("ContEmail").Set Email_id

Browser("Sign up for a FREE SurveyMonke").Page("Sign up for a FREE SurveyMonke").WebElement("Sign Up").Click
wait 5

If Browser("Sign up for a FREE SurveyMonke").Page("Welcome to SurveyMonkey!").Link("Sign Out").Exist then
    objexcelsheet.cells(2,5).value="Passed"
    objexcelsheet.cells(2,2).value=Fnrandomusername
    objexcelsheet.cells(2,7).value=FnrandomEmailid
    objexcelsheet.cells(2,6).value="Registration_successful"
    else
    objexcelsheet.cells(2,5).value="Failed"
    objexcelsheet.cells(2,6).value="Resistration_Failed"

end if
browser("index:=0").page("index:=0").CaptureBitmap"c:/Login_verification1.png",true


wait 3
Browser("Sign up for a FREE SurveyMonke").Page("Welcome to SurveyMonkey!").Link("Sign Out").Click

FnClose_browser

i=2+1

next

'Browser("Welcome to SurveyMonkey!").Page("Welcome to SurveyMonkey!").Link("Sign Out").Click

'objexcelsheet.cells(2,2).value=username
objexcelsheet.cells(2,3).value=Password
objexcelsheet.cells(2,4).value=Retype_password

objExcel.activeworkbook.save
objExcel.activeworkbook.close
objExcel.application.quit

set objExcel=nothing
set objExcelsheet=nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to use looping statement dmvelic083185 1 1,278 09-26-2017, 08:46 PM
Last Post: Ankur
  problem in looping statements... navyasatish 5 4,175 02-02-2012, 02:23 PM
Last Post: rajpes
  Looping wont stop laura 3 3,171 07-06-2009, 02:11 PM
Last Post: basanth27
  Looping and seting value laura 5 3,688 07-03-2009, 01:13 PM
Last Post: Ankur
  Code won't stop looping through imported spreadsheet Mike72688 6 5,689 01-08-2009, 07:21 PM
Last Post: Mike72688

Forum Jump:


Users browsing this thread: 1 Guest(s)