0

現在の URL ( http://example.com) を変数に保存し、gotoIf コマンド (gotoIf extension.js の一部) の条件として別の文字列と比較しようとしています。

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

この seleniun ide を実行すると、次のエラーがスローされます。

[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 は文字列を返す必要があるのに、なぜこのエラーが発生するのでしょうか?構文のどこが間違っているのでしょうか?また、このコマンドを宣言するにはどうすればよいでしょうか?

4

3 に答える 3

1

エラーメッセージは次のとおりです。

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

おそらく、式を次のように変更する必要があります。

gotoIf || "$ {url}" == "http://example.com" || ラベル

有効な式を取得するには、次のようにします。

eval( "\" http://example.com \ "== \" http://example.com \ "")
于 2010-04-16T15:11:24.577 に答える
1

ええ..これはうまくいきます

gotoIf || "${x}"=="${y}"
于 2010-07-08T10:33:16.343 に答える
0
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>
于 2012-02-04T12:56:35.743 に答える