|
代码如下:
package com.testscripts;
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;
public class Untitled extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://bbs.51testing.com", "*iexplore");
}
/**
* @throws Exception
*/
public void testNew() throws Exception {
selenium.open("/");
selenium.waitForPageToLoad("30000");
}
public static void main(String[] args) throws Exception {
Untitled u=new Untitled();
u.setUp();
u.testNew();
}
}
---------------------------------------------------------------------------------------------
执行后,能打开 51testing的页面,但是会报如下错误:
Exception in thread "main" com.thoughtworks.selenium.SeleniumException: Timed out after 30000ms
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:353)
at com.testscripts.Untitled.testNew(Untitled.java:17)
at com.testscripts.Untitled.main(Untitled.java:25)
从Server 日志看应该是在执行open时,超时了,不知道是什么原因
server日志:
17:42:48.024 INFO - Command request: getNewBrowserSession[*iexplore, http://bbs.
51testing.com, ] on session null
17:42:48.024 INFO - creating new remote session
17:42:48.024 INFO - Allocated session de0bac9956ef43d99ab9a78252284806 for http:
//bbs.51testing.com, launching...
17:42:49.025 INFO - Launching Embedded Internet Explorer...
17:42:50.037 INFO - Launching Internet Explorer HTA...
17:42:52.280 INFO - Got result: OK,de0bac9956ef43d99ab9a78252284806 on session d
e0bac9956ef43d99ab9a78252284806
17:42:52.290 INFO - Command request: open[/, ] on session de0bac9956ef43d99ab9a7
8252284806
17:43:22.383 INFO - Got result: Timed out after 30000ms on session de0bac9956ef4
3d99ab9a78252284806 |
|