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?
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\"")
yeap.. this works fine
gotoIf || "${x}"=="${y}"
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>
精彩评论