views:

527

answers:

2

I am trying to store the current url (http://example.com)in a variable and compare it with another string as a condition in the gotoIf command (part of the gotoIf extension.js):

    storeLocation || url
    gotoIf || ${url}=="http://example.com" || label

When I run this seleniun ide throws this error:

[error] Unexpected Exception: message -> syntax error, fileName -> chrome://selenium-ide/content/tools.js -> file:///C:/Users/David%20Cunningham/Desktop/extensions_js/extensions.js, lineNumber -> 183, stack -> eval("http://example.com==\"http://example.com\"")@:0 ("http://example.com==\"http://example.com\"","label1")@chrome://selenium-ide/content/tools.js -> file:///C:/Users/David%20Cunningham/Desktop/extensions_js/extensions.js:183 ("http://example.com==\"http://example.com\"","label1")@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/selenium-commandhandlers.js:310 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:112 (6)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 (6)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> SyntaxError 

storeLocation should return a String so why am i getting this error, what is wrong with the syntax and how do I declare this command?

A: 

The error message shows:

eval("http://example.com==\"http://example.com\"")

You should probably change your expression to:

gotoIf || "${url}"=="http://example.com" || label

So that you'll get a valid expression:

eval("\"http://example.com\"==\"http://example.com\"")
Ates Goral
A: 

yeap.. this works fine

gotoIf || "${x}"=="${y}"

sara