Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
Techniker
Posts : 3
Join date : 2012-01-24

simple numerical calculation with variables -need help- Empty simple numerical calculation with variables -need help-

Tue Jan 24, 2012 1:10 am
Hello to everyone.


First, I`m glad that I found this forum. Since a few days i try to make some simple numerical calculations with variables.


For example:


store 10 x

store 5 y

store eval storedVars['x']-storedVars['y'] Z

echo ${Z}


then, I recieve a error in the log: NaN.


Could anybody give me an example for a numerical calculation please.


Best wishes fom the northern part of germany.


Techniker
avatar
Techniker
Posts : 3
Join date : 2012-01-24

simple numerical calculation with variables -need help- Empty Re: simple numerical calculation with variables -need help-

Tue Jan 24, 2012 5:12 pm
I found the solution myself.

StoreEval javascript{storedVars['x']-storedVars['y']} Z

And the NaN occours only because I didn`t got the value from the html
rohit13
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 37
Location : INDIA
http://radical-qa.blogspot.in/

simple numerical calculation with variables -need help- Empty Re: simple numerical calculation with variables -need help-

Thu Apr 12, 2012 6:54 pm
Use below code, change operator as per your requirements

Code:
store  |10 | x

store  | 5  | y

storeEval | ${x}+${y} |    Z

echo  | ${Z}
avatar
vlady_1027
Posts : 1
Join date : 2012-05-12

simple numerical calculation with variables -need help- Empty Re: simple numerical calculation with variables -need help-

Tue Jun 05, 2012 8:46 pm
rohit13 wrote:Use below code, change operator as per your requirements

Code:
store |10 | x

store | 5 | y

storeEval | ${x}+${y} | Z

echo | ${Z}



Hello,

Store | 10 | x

Store | 5.99 |y

storeEval | ${x}*${y} | Z

echo | ${Z}

I get Z = 59.900000000000006

Could you tell me how can I get Z to be equal 59.90?



Thanks!
kashyap_guru
kashyap_guru
Active particpant
Active particpant
Posts : 24
Join date : 2013-10-16
Age : 37
Location : India

simple numerical calculation with variables -need help- Empty Re: simple numerical calculation with variables -need help-

Fri Oct 18, 2013 1:05 pm
Here is your answer vlady_1027...

Store | 10 | x

Store | 5.99 |y

storeEval | ${x}*${y} | Z


storeEval | javascript:{${Z}.toFixed(2)} | Z
Sponsored content

simple numerical calculation with variables -need help- Empty Re: simple numerical calculation with variables -need help-

Back to top
Permissions in this forum:
You cannot reply to topics in this forum