Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Condition for Checkpoints
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
I have written a script to check all the reports in all the applications of my Product.
Code:
Browser("Conrep-Ex-Employees").Page("Conrep-Ex-Employees").Frame("fr1").WebElement("SCODE:").Click
Browser("Conrep-Ex-Employees").Page("Conrep-Ex-Employees").Frame("fr1").WebEdit("txtPageCode").Set DataTable("RpName", dtGlobalSheet)
Browser("Conrep-Ex-Employees").Page("Conrep-Ex-Employees").Frame("fr1").Image("1440_hotOk_16_h_g").Click
Browser("Conrep-Ex-Employees").Page("Conrep-Ex-Employees").Frame("frPage").Link("Quick Links  »").Check (CheckPoint("Quick Links  »_7"))

If on the screen "Quick Links" is there then it has to show the msg as "Pass" otherwise it has to show as "Fail"

How can I execute this?

Thanks in advance
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
You can use 'Exist' to check whether your link is there or not on the screen

try this
Code:
if Browser("Conrep-Ex-Employees").Page("Conrep-Ex-Employees").Frame("frPage").Link("Quick Links »").Exist then
msgbox "Pass"
else
msgbox "Fail"
end if

Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Code:
a = Browser("Conrep-Ex-Employees").Page("Conrep-Ex-Employees").Frame("frPage").Link("Quick Links  »").Check (CheckPoint("Quick Links  »_7"))
msgbox a
If a <> 1 Then
  Reporter.ReportEvent micpass, "Quick Links", "QuickLinks are displayed"
Else
  Reporter.reportevent micfail, "Quick Links", "QuickLinks are not Displayed"
End If

Sorry, Please edit If a<>1 to If a<>0
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
Ah!! Sorry Sudhamshu,

I just ignored the checkpoint you used,Please go with Basanth's reply.
May be there could be some specific reson for using checkpoint, but in my opinion we should always opt for the simple solutions Smile

Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Guys thanks for your reply. I have modified my code and mostly it is working now. As my code is like this

Code:
Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("fr1").WebEdit("txtPageCode").Set DataTable("Scode", dtGlobalSheet)
Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("fr1").Image("1440_hotOk_16_h_g").Click
If Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("frPage").Link("Quick Links  »").Exist then
    msgbox("Report is Configured")
else if Browser("Conrep-by Division_2").Page("Conrep-by Division").Frame("frPage").WebElement("Technical Problem (Critical)!").Exist then
msgbox("Technical Error")
else if Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("frPage_2").Link("My User Profile").Exist then
msgbox("Target Report is not available.")
else msgbox("Please enter a valid file scode...")
End if
End if
End if
Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("fr1").Image("Home").FireEvent "onmouseover"
Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("fr1").Image("Home").Click
wait 5

Actually it has the four conditions.
1. Report should show if Quick Links are there in the screen.
2. Should show the Technical error if it is there in the screen.
3. Should show Target Report is not available if this frame is there in the screen.
4. Should show Please enter a valid file scode... if this frame is there in the screen.

And one more small help please.
Actually it should show only the reports which are fine (First Case) and it should through error msgs for all other scenarios in the final results.

To be specific, to the addition of my logic, how can I get the final result where I can check that which reports are not fine?

Thanks in advance guys.
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
if i am getting your question right, you dont want the messages to pop up, you want the corresponding result to the final qtp result.
to do this you should use 'Reporter.ReportEvent'
e.g
Code:
If Browser("Conrep-C2C Consultants").Page("Conrep-C2C Consultants").Frame("frPage").Link("Quick Links »").Exist then
Reporter.ReportEvent micPass, "Check Quick Links", "Link Exists"
is this what you are looking for?

Note :- always put your codes in proper tags to make it more readable and follow one query per thread.

Reply
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
Thks guys it worked out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Fixing broken Checkpoints mv8167 2 2,937 02-02-2012, 10:00 PM
Last Post: mv8167
  Changing existing checkpoints janriis 1 3,240 12-13-2009, 12:55 PM
Last Post: basanth27
  Adding checkpoints anbarasu 2 3,049 10-23-2009, 05:18 PM
Last Post: anbarasu
  Need help with checkpoints lalabhaiya 3 2,732 10-16-2009, 02:53 PM
Last Post: Ankur
  Difference between checkpoints and outputvalues satyadon 1 4,338 10-21-2008, 11:02 PM
Last Post: satyadon

Forum Jump:


Users browsing this thread: 2 Guest(s)