Selenium RC launches Firefox5 and IE8 browser but does not go to the specified url
I'm a beginner at selenium, trying to follow a tutorial using eclipse and testng. However, it appears that the actual test does not get carried out because it doesn't navigate to the url in my code.
This is my input:
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's ouput:
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 org.openqa.jetty.jetty.servlet.ServletHandler@1be2d65
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 org.openqa.jetty.jetty.Server@32fb4f
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开发者_JS百科 INFO - Launching Internet Explorer HTA...
the program does not terminate.
For firefox the browser opens a blank url. For IE8, it navigates to a local temporary folder.
How do I get it to navigate to the url as specified?
Which version of selenium-standalone-server you are having? Do you have stanalone server on you lib folder?.Please download Selenium-server-standalone-2.0b3.jar and replace with existing one . Let me know still you are having any issues?
Excellent!!! I was having lots of trouble finding out the issue. Turns out that Selenium Server jar file that I was using is outdated. Also, the one mentioned above Selenium-server-standalone-2.0b3.jar is deprecated. So taking cue from the above answer from Mani, went to this link http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.3.0.jar&can=1&q=Selenium-server-standalone and downloaded selenium-server-standalone-2.3.0.jar and replaced this with the old selenium-server.jar file. Voila... now firefox4 and firefox5 work :)
Thanks, Safi
精彩评论