Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular Expression
#1
Not Solved
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...


Attached Files Image(s)
       
Reply
#2
Not Solved
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
   Print "Shipmnet is Free."
Else
  Print "U will be charged for the shipment."
End IF

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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
Reply
#3
Not Solved
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.
strCartSubTotal = Browser("officeworks").Page("ShopingCart").WebTable("PricingInfo").webelement("CartSubTotal").GetRoProperty("innertext")
strShippingChrg = Browser("officeworks").Page("ShopingCart").WebTable("PricingInfo").webelement("ShipingCharge").GetRoProperty("innertext")
If strCartSubTotal > 55 and strShippingChrg = "Free" Then
  msgbox "Free shiping as the subtotal is " & strCartSubTotal
ElseIf strCartSubTotal <= 55 and strShippingChrg = "Free" Then
  msgbox "Error: Showing Free shipping even the cart subtotal is not more than $55. The cart subtotal is : " & strCartSubTotal
ElseIf strCartSubTotal > 55 and strShippingChrg = "$5.95" Then
  msgbox "Erro: Showing shipping fee even the cart subtotal is more than $55. The cart subtotal is : " & strCartSubTotal
ElseIf strCartSubTotal <= 55 and strShippingChrg = "$5.95" Then
  msgbox "Shiping of $5.95 displayed correctly as the subtotal is " & strCartSubTotal
EndIf

Please let me know if you need any further info on this.


Thanks,
SUpputuri
Reply
#4
Not Solved
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
t4= t3 & Reporter.ReportEvent micPass, "Estimated Delivery Fee", "Estimated Delivery Fee is FREE"
End if

Code:
If cint(t3) < 55 then
    t4= cint(t3)+ 5.95 & Reporter.ReportEvent micPass, "Estimated Delivery Fee", "Estimated Delivery Fee is $5.95"
End If
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Please help me with Regular Expression nessa2018 2 1,553 09-25-2018, 03:15 PM
Last Post: Ankur
  Regular Expression Suma Parimal 3 2,404 01-17-2014, 03:18 PM
Last Post: basanth27
  regular expression rjkmr.aiht 0 1,778 05-07-2012, 11:34 AM
Last Post: rjkmr.aiht
  regular expression rjkmr.aiht 3 3,151 04-25-2012, 06:09 PM
Last Post: sshukla12
  Regular expression for time validation Pallavi 0 2,517 03-08-2012, 11:57 AM
Last Post: Pallavi

Forum Jump:


Users browsing this thread: 1 Guest(s)