我是一個初學者,嘗試使用eclipse和testng來學習一個教程。然而,看起來實際的測試並沒有得到執行,因爲它沒有導航到我的代碼中的網址。Selenium RC啓動Firefox5和IE8瀏覽器,但沒有去指定的網址
這是我輸入:
package script;
import com.thoughtworks.selenium.*;
import org.junit.AfterClass;
import org.testng.annotations.*;
import org.openqa.selenium.server.SeleniumServer;
public class Baseline extends SeleneseTestCase {
@BeforeClass
public void setUp() throws Exception {
SeleniumServer seleniumserver = new SeleniumServer();
seleniumserver.boot();
seleniumserver.start();
setUp("http://www.google.com", "*iexplore");
}
@Test
public void testBaseline(){
selenium.open("/");
selenium.windowMaximize();
selenium.windowFocus();
selenium.type("q", "selenium rc");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("Results * for selenium rc"));
}
@AfterClass
public void tearDown(){
selenium.close();
selenium.stop();
}
}
TestNG的輸出繼電器:
16:44:10.326 INFO - Java: Sun Microsystems Inc. 20.1-b02
16:44:10.328 INFO - OS: Windows 7 6.1 x86
16:44:10.339 INFO - v2.0 [a2], with Core v2.0 [a2]
16:44:10.459 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
16:44:10.461 INFO - Version Jetty/5.1.x
16:44:10.461 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
16:44:10.462 INFO - Started HttpContext[/selenium-server,/selenium-server]
16:44:10.462 INFO - Started HttpContext[/,/]
16:44:10.503 INFO - Started [email protected]
16:44:10.503 INFO - Started HttpContext[/wd,/wd]
16:44:10.506 INFO - Started SocketListener on 0.0.0.0:4444
16:44:10.506 INFO - Started [email protected]
16:44:10.563 INFO - Checking Resource aliases
16:44:10.570 INFO - Command request: getNewBrowserSession[*iexplore, http://www.google.com, ] on session null
16:44:10.572 INFO - creating new remote session
16:44:10.695 INFO - Allocated session 4a50ca969de04033b77cdb88dfd8af1a for http://www.google.com, launching...
16:44:11.106 INFO - Launching Embedded Internet Explorer...
16:44:12.126 INFO - Launching Internet Explorer HTA...
程序不會終止。
對於Firefox瀏覽器打開一個空白的URL。對於IE8,它導航到本地臨時文件夾。
如何獲取它導航到指定的網址?