GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Testing Tools  >  QTP
Go To First  |  Previous Question  |  Next Question 
 QTP  |  Question 651 of 684    Print  
Regular expressions for web testing
Browser("Yahoo! Mail: The best").Page("(2 unread) Yahoo! Mail").Link("Inbox (2)").Click

this is the recorded script i get after performing the action on yahoo mail..now when i run the test again ...the page title and link name changes as the no. of emails in inbox increases...so the error says cannot find the object.

can someone please tell me what regular expressions i should used for this script ?



  
Total Answers and Comments: 5 Last Update: January 23, 2009     Asked by: anushankar 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 04, 2008 06:32:09   #1  
ramupalanki Member Since: December 2007   Contribution: 10    

RE: Regular expressions for web testing
Use the following code which suites your inquiries


Browser("title: .*Yahoo!.*").Page(".*Yahoo!.*").Link("Inbox.*").Click

Try this and let me know if it executed properly


Ramu

 
Is this answer useful? Yes | No
June 12, 2008 16:51:12   #2  
atdhdrolla Member Since: March 2007   Contribution: 19    

RE: Regular expressions for web testing
Please use descriptive programming laguage. Your code should look like something as below

Browser("name: .*Yahoo!.*" "title: .*Yahoo!.*").Page("title: .*Yahoo!.*").WebTable("name: login").WebEdit("name: login").Set "XYZ"

Use object spy tool in QTP to learn the properties of the object and use them in desciptive language. I hope it should help you

 
Is this answer useful? Yes | No
July 03, 2008 02:22:32   #3  
krishna1978 Member Since: July 2008   Contribution: 4    

RE: Regular expressions for web testing
Instead of "2 unread" you can regularise the option with a regular expression as [0-9]* in the palce of 2 and do not forget to check the regular expression check box.
 
Is this answer useful? Yes | No
July 05, 2008 00:15:27   #4  
Padmanaban_hsui Member Since: July 2008   Contribution: 1    

RE: Regular expressions for web testing
Browser("Yahoo! Mail: The best").Page("(2 unread) Yahoo! Mail").Link("Inbox (2)").

we can resolve this issue by Regular Expresions. In the Object Repository change the Value of the object using .* and save the change in the Object Repository.

eg) Page("(2 unread) Yahoo! Mail") --> instead of this (2 unread) Yahoo! Mail) object change the object to a common name wih .*

this can be handled even using Descriptive Programming by give the Value of a unique property in the Code itself

 
Is this answer useful? Yes | No
January 23, 2009 01:35:31   #5  
srivani123 Member Since: November 2007   Contribution: 9    

RE: Regular expressions for web testing
Today I tried after read your question. You know what I did I just changed the object name in the object repository file.ie.
when you are recording if is inbox(4) then running it must be inbox(3) in the application.
so go to resource->object repository-> and change inbox(4) as inbox(3) in object name (inbox(4) will come when you expand object tree in repository file). then it is recognising the object and working fine.
please let me know if it is wrong I am a beginner.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape