Quantcast
Channel: Micro Focus QTP (UFT) Forums - All Forums
Viewing all articles
Browse latest Browse all 1793

Problem With conversion function

$
0
0
Hi, all 

I am  Wajid from USA and new to UFT. I have some problem with my script.

I have written script where I can compare Estimated and actual cost and print Pass or fail result.

My estimated amount is 15700 that changes with every iteration but my actual cost is in currency like $15,700

I have used conversion functions that converts $15,700 to 15700 like Ccur, Cstr, CDbl

When I use above functions on simple test they work properly but when I use them in my script I get Type mismatch error.

I have Created a variable Actual_Price for Actual Price because I am capturing an output from website and the using CAprice variable to convert Actual_Price output.

My script is given below I can share entire script if you want.

Thanks in advance.


Code:
Actual_Price = Browser("Micclass:=Browser","Creationtime:=0","Title:=.*").Page("Micclass:=Page","Creationtime:=0","Title:=.*").webelement("class:=calc-results-total","html id:=ac_max_tmv_result","html tag:=SPAN").GetROProperty("innertext")


Print Actual_Price & "  Before Conversion"

CAprice = Cdbl(Actual_Price)

Print "Actual Price " & Actual_Price  & " Converted Actual Price" & CAprice

Print " and Estimated Price is = " & Estimated_Price

If CAprice = Estimated_Price Then

Print " Actual Price Test Pass"

Else
Print "Actual Price Test Faill"

Viewing all articles
Browse latest Browse all 1793


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>