Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with If - Then statement
#1
Solved: 10 Years, 9 Months, 1 Week ago
My company has just introduced the QTP and we have been asked to start working on it. I have no prior experience with it.

as an exercise, i started testing the yahoo mail. Those of you who have used yahoo, know that Yahoo lets you sign into the messenger chat by clicking on the offline link (on top of the page in yahoo inbox) and then lets u chose the options like available, or sign in as invisible etc. I am trying to write a statement which checks that if the value for that web element is "offline", then it should click on offline and then click on the available link. i have written the following code but it doesnt seem to work. Your help is much appreciated.
Code:
If Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_3").WebElement("Offline") Then
Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_3").WebElement("Offline").Click
Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_2").WebElement("Available").Click
End If
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
hi,

try the following.

Code:
If Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_3").WebElement("Offline").exist Then
Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_3").WebElement("Offline").Click
Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_2").WebElement("Available").Click
End If
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
Hi,

Hope you forget to give the condition...

If (Condition) = true then

Statement....

Else

Statement

End If


Code:
If Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_3").WebElement("Offline").GetROProperty("value",Offline)=False Then
Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_3").WebElement("Offline").Click Else
Browser("Yahoo! Mail: The best").Page("(9 unread) Yahoo! Mail,_2").WebElement("Available").Click
End If

Stephen
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)