2017-07-19 1 views
0

Selenium IDEを使用してWebアクションを記録するときに、IDEがJavaScriptを停止しているときにエラーメッセージ "too much recursion"が表示されます。Selenium IDEがJavaScriptを停止しています

セレンIDE 2.9.1.1

ブラウザ:FireFoxの54.0.1

私はそれはまた、セレンにより停止し、テストのための簡単なjavascriptのアラートを書きました。

<html> 
<head> 
    <script> 
     function hello(){ 
      alert("Hello\nHow are you?"); 
     } 
    </script> 
</head> 
<body> 
    <input type="button" onclick="hello();" value="Say Hi" /> 
</body> 
</html> 

enter image description here

セレン-IDE /コンテンツ/ recorder.js

Recorder.prototype.reattachWindowMethods = function() { 
    var window = this.getWrappedWindow(); 
    //this.log.debug("reattach"); 
    if (!this.windowMethods) { 
     this.originalOpen = window.open; 
    } 
    this.windowMethods = {}; 
    ['alert', 'confirm', 'prompt', 'open'].forEach(function(method) { 
      this.windowMethods[method] = window[method]; 
     }, this); 
    var self = this; 
    window.alert = function(alert) { 
     self.windowMethods['alert'].call(self.window, alert); 
     self.record('assertAlert', alert); 
    } 
} 
+1

があなたのセレンスクリプト – Liam

+0

だけの更新を表示、例外は 'self.windowMethods [ '警告']コール(self.window、警告)ここに出てきました;' – Jotzuc

答えて

0

関数呼び出しが実際にセレン自身のJavaScriptによって実行時に上書きされているためです。 再起動後、この問題を解決することができます以下のセレクションのコアユーザー拡張にJavascriptコードを追加します。 。

//http://docs.seleniumhq.org/docs/08_user_extensions.jsp 
Selenium.prototype.doExecute = function(script) { 
    this.browserbot.getCurrentWindow().eval(script); 
}; 
Selenium.prototype.getExecute = function(script) { 
    return this.browserbot.getCurrentWindow().eval(script); 
}; 
Selenium.prototype.getJqMethod = function(selector, method) { 
    return this.getExecute('$("' + selector + '").' + method + '();'); 
}; 
Selenium.prototype.getJqText = function(selector) { 
    return this.getJqMethod(selector, "text"); 
}; 
Selenium.prototype.getJqHtml = function(selector) { 
    return this.getJqMethod(selector, "html"); 
}; 
Selenium.prototype.getJqVal = function(selector) { 
    return this.getJqMethod(selector, "val"); 
}; 
PageBot.prototype.locateElementByJq = function(selector, inDocument) { 
    // FF/Chrome/IE9+: defaultView, OldIE: parentWindow 
    return (inDocument.defaultView || inDocument.parentWindow) 
      .eval("jQuery('" + selector.replace(/'/g, "\\'") + "')[0];"); 
}; 
関連する問題