Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

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\"")
share|improve this answer
add comment

yeap.. this works fine

gotoIf || "${x}"=="${y}"
share|improve this answer
1  
It will be more helpful if you explain your answer. –  JSuar Dec 18 '12 at 3:09
add comment
try out this one   

 <tr>
        <td>storeLocation</td>
        <td>j</td>
        <td></td>
    </tr>
    <tr>
        <td>echo</td>
        <td>${j}</td>
        <td></td>
    </tr>
    <tr>
        <td>store</td>
        <td>http://www.google.com</td>
        <td>i</td>
    </tr>
    <tr>
        <td>echo</td>
        <td>${i}</td>
        <td></td>
    </tr>
    <tr>
        <td>gotoIf</td>
        <td>storedVars['i']==storedVars['j']</td>
        <td>label</td>
    </tr>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.