Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to replace/reset the Selenium's storeEval variable everytime we run the program?

View previous topic View next topic Go down

How to replace/reset the Selenium's storeEval variable everytime we run the program?

Post by jayz123 on Mon Nov 19, 2012 11:29 am

Hi guys,

I am new to Selenium Rc.
I am working out on a program that will generated random 5 digit numbers based on a button click.
I am using this code to have the generated number
Code:
 String random = selenium.GetEval("Math.floor (Math.random() * 99999)");
          selenium.Type("id=name",random);

First try it will get me 12345 for example.
However, if i am not restarting my application and I click second time on button, the number will become 1234512345. It seem like the it will keep generated another 5 numbers every time i click the button and store in the variable. If i restart my program, it will work well by only generate 5 digits.

I wish is there any solution to handle this problem?

jayz123

Posts : 8
Join date : 2012-11-14

Back to top Go down

Re: How to replace/reset the Selenium's storeEval variable everytime we run the program?

Post by Adviser on Mon Nov 19, 2012 8:49 pm

hi,
declare one string variable. put math.floor value into that variable and at start make it null/blank before storing value.

Code:

selenium.GetEval("var digits = null; digits = Math.floor (Math.random() * 99999); return digits;")

Hope this will help. logic is fine, may be syntax error will come.

Best of luck



_________________
Spread Your Knowledge About Selenium Tool.

Administrator
Email: selenium.discussion.thread@live.com
Forum: http://seleniumforum.forumotion.net

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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