Share
Go down
rajareddy
Active particpant
Active particpant
Posts : 11
Join date : 2012-06-07

How to compare two stored variable values in Selenium IDE

on Tue Jun 12, 2012 1:40 pm
Hi,

Could you please help me how to compare two stored variable values in Selenium IDE

I have used "StoreText" and "Echo" commands and stored the values of a variable/element from two different URLs But I am unable to compare whether the value for that element in both the sites is same or not?. So please help me out of this.

Thanks,

Raja Reddy
avatar
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 31
Location : INDIA
http://radical-qa.blogspot.in/

Re: How to compare two stored variable values in Selenium IDE

on Tue Jun 12, 2012 2:27 pm
Below is sample code for comparison
Code:
store  |    https://www.google.co.in/  |  base
storeLocation  |  base2
gotoIf  |  storedVars['base']==storedVars['base2']  |  true
getEval  |  alert("Not Matching")
gotolabel  |  finish
label  |  true
getEval  |  alert("Matching")
label  |  finish

_________________
Radical QA
http://radical-qa.blogspot.in/
rajareddy
Active particpant
Active particpant
Posts : 11
Join date : 2012-06-07

How to compare two stored variable values in Selenium IDE

on Tue Jun 12, 2012 3:51 pm
Hi,

I have tried doing with the code that you have given, but I am unable to find "gotoIf" command and getting "Unknown Command" exception. So please find attached the screen shots for the same and kindly help me out of this issue.

Thanks,
Raja Reddy
avatar
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 31
Location : INDIA
http://radical-qa.blogspot.in/

Re: How to compare two stored variable values in Selenium IDE

on Tue Jun 12, 2012 4:02 pm
ohh..actually selenium IDE doesn't support this command directly,
you need to add user extension for it - goto_sel_ide.js
http://wiki.openqa.org/pages/viewpageattachments.action?pageId=379&metadataLink=true
You download it from above link.
For reference go to - http://radical-qa.blogspot.in/2012/02/selenium-ide_09.html

_________________
Radical QA
http://radical-qa.blogspot.in/
rajareddy
Active particpant
Active particpant
Posts : 11
Join date : 2012-06-07

How to compare two stored variable values in Selenium IDE

on Tue Jun 12, 2012 7:11 pm
Hi,

Thank you so much.........!

Now I am able to use "gotoIf", but I am unable to use "getEval", so please help me out saying how can i get this please.

Is there any other user extensions that I have to upload, if yes can you please help me where can i get those.

Thanks,
Raja Reddy
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: How to compare two stored variable values in Selenium IDE

on Wed Jun 13, 2012 5:16 am
getEval doesn't auto-complete for some reason in the command field. Just type it in. Selenium should recognize it that way

If this doesn't work, what error are you getting?
rajareddy
Active particpant
Active particpant
Posts : 11
Join date : 2012-06-07

How to compare two stored variable values in Selenium IDE

on Wed Jun 13, 2012 12:17 pm
Hi,

Thank you so much........ I am not getting any error on using "getEval" manually.But even though the values of stored variable "a" and stored variable "b" is not same it is showing as "Matching". So please kindly help me out from this issue. for your reference please find the attached screen shots.

Thanks,
Raja Reddy
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: How to compare two stored variable values in Selenium IDE

on Thu Jun 14, 2012 3:17 am
Where are the screen shots?

try using:
echo | ${a}
echo | ${b}

I suspect the store command you are using may be storing if that link is present as opposed to the actual value. If this is the case, both "a" and "b" will be "true"
rajareddy
Active particpant
Active particpant
Posts : 11
Join date : 2012-06-07

How to compare two stored variable values in Selenium IDE

on Thu Jun 14, 2012 1:21 pm
Hi,

Thank you so much..... It's working great with "echo" command. But instead of getting an alert I have to save/print the a, b and comparison result to an Excel Sheet. So please kindly help me saying how to save the values to an Excel sheet using Selenium IDE please.

Thanks,
Raja Reddy
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: How to compare two stored variable values in Selenium IDE

on Fri Jun 15, 2012 4:36 am
This is not supported functionality in Selenium IDE. You would have to use RC or Webdriver.
epivnik
Posts : 2
Join date : 2013-02-01

Re: How to compare two stored variable values in Selenium IDE

on Fri Feb 01, 2013 2:45 am
In the IDE I would do something like this.....

# check if 2 variables are equal

storeEval | javascript{ storedVars['a'] == storedVars['b'] | c
echo | ${c}
Nevermind
Posts : 1
Join date : 2013-02-22

Re: How to compare two stored variable values in Selenium IDE

on Fri Feb 22, 2013 12:40 pm
assertEval can be used to compare strings

assertEval | storedVars['a'] == storedVars['b'] | true
Sponsored content

Re: How to compare two stored variable values in Selenium IDE

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