selenium rc 在IE下运行的问题!急!急!!急!!!
我键入命令 java -jar selenium-server.jar -htmlSuite "*iexplore" "http://192.168.1.149:8080/mail/" "E:\auto.html" "E:\results_jwj.html"可是 在selenium 自启动 浏览器时 报错如下:
HTML suite exception seen:
java.lang.RuntimeException: sessionId 467215 doesn't exist ; perhaps this session was already stopped?
这个 sessionId 467215 是随机的 , 它到底是怎么来的?
为什么使用 Firefox 没有这个问题? 猜测是原ie进程没有结束,在任务管理器看看有没有,杀掉,或者注销。还不行就是另外原因了 问题已经解决。
这是selenium-rc 1.0.2和1.0.3存在的共性bug,目前bug已解决。
解决方案如下:
I look into the source and the bug was introduce by the SVN revision
* Revision 7188
* Date 01/09/2009
* Author: hbchai
* Comment: Improve setExtensionJs() for HTA mode.
* Modified files:
/selenium-rc/trunk/server-coreless/src/main/java/org/openqa/selenium/server/browserlaunchers/HTABrowserLauncher.java
Diff
Index: HTABrowserLauncher.java
===================================================================
— HTABrowserLauncher.java (revision 7187)
+++ HTABrowserLauncher.java (revision 7188)
@@ -4,19 +4,22 @@
*/
package org.openqa.selenium.server.browserlaunchers;
-import java.io.*;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
import org.apache.commons.logging.Log;
-import org.apache.tools.ant.util.*;
+import org.apache.tools.ant.util.FileUtils;
import org.mortbay.log.LogFactory;
import org.openqa.selenium.server.BrowserConfigurationOptions;
+import org.openqa.selenium.server.FrameGroupCommandQueueSet;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.browserlaunchers.locators.InternetExplorerLocator;
//EB - Why doesn't this class extend AbstractBrowserLauncher
//DGF - because it would override every method of ABL.
public class HTABrowserLauncher implements BrowserLauncher { - static Log log = LogFactory.getLog(HTABrowserLauncher.class); private String sessionId; private File dir; @@ -96,13 +99,36 @@ }
f.copyFile(selRunnerSrc, selRunnerDest);
f.copyFile(testRunnerSrc, testRunnerDest);
+ writeSessionExtensionJs(coreDir);
} catch (IOException e) { throw new RuntimeException(e); }
+ }
+
+ /**
+ * Writes the session extension javascript to the custom profile directory.
+ * The request for it does not pass through the Selenium server in HTA
+ * mode, thus the specialized extension js resource handler is of no use.
+ *
+ * @param coreDir
+ * @throws IOException
+ */
+ private void writeSessionExtensionJs(File coreDir) throws IOException {
+ FrameGroupCommandQueueSet queueSet =
+ FrameGroupCommandQueueSet.getQueueSet(sessionId);
*
+ if (queueSet.getExtensionJs().length() > 0) { + String path = "scripts/user-extensions.js[" + sessionId + "]"; + FileWriter fileWriter = new FileWriter(new File(coreDir, path)); + BufferedWriter writer = new BufferedWriter(fileWriter); + + writer.write(queueSet.getExtensionJs()); + writer.close(); + + fileWriter.close(); + }
}
-
+
public void close() {
if (browserOptions.is("killProcessesByName")) {
WindowsUtils.tryToKillByName("iexplore.exe");
-----嘿嘿 ,把带加号的删去.然后再编译一下,替换掉selenium-server.jar包中的一个HTABrowserLauncher.class类就可以. 赞 这个问题都能找出来,你太强了,佩服 这个牛~~
页:
[1]