![]() |
Regular Expression - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Regular Expression (/Thread-Regular-Expression--5362) |
Regular Expression - Himanshu2585 - 09-08-2011 My Application is Retails based web application. On the Shopping Cart page if a slect the item price more than $55 the Shipping Charges would be displayed as "FREE" else it is displayed as $5.95...i have placed a Text Checkpoint on this field... Just want to know hot make this checkpoint as regular expression... would it be like [a-z A-Z 0-9]* ?? Please give some information on this as i m a beginner to QTP.. Attached is a two screenshots... RE: Regular Expression - Ankesh - 09-08-2011 Hi Himanshu, I have one question, why do u want to use a regular expression for the shipment field whne u know there are only two possible values - FREE/$5.95. My suggestion to u would be that u better fetch the Shipment value using GetRoProperty and then use the code as below with some modification Code: strShipmetCharge=Browser().Page().WebElement("<ObjectName>").getRoProperty("text") after fetching the value u can compare it Code: if strShipmetCharge="FREE" Then '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If this doesn't serve ur purpose, do let me know i will provide u the regular expression for ur requirement. One request be very clear abt ur question-- like what u want to do, on which field and why? This would of much help for the viewers and u will get proper response. Regards, Ankesh RE: Regular Expression - supputuri - 09-08-2011 HI, I would rather suggest to go with the text comparision rather than the checkpoint. Get the text from that field and then compare with your expected result. Code: 'Some will be something like this. Please let me know if you need any further info on this. RE: Regular Expression - Himanshu2585 - 09-13-2011 Thanks Supputuri for your help...i have one another thing like From the previous screenshots i have attached cint(t3) is Cart Sub total and t4 is Estimated total... Below is the condition that u have tried for "if Cart Subtotal is greater than 55 then cart subttal and estimated total are equal and report event" and in second condition "if Cart Subtotal is smaller than 55 then cart subtotal + 5.95 is equal to estimated total are equal and report event" Can you give me the correct way to put these condition in loop (if then else)with reporter.reportevent. Code: If cint(t3) > 55 Then Code: If cint(t3) < 55 then |