FirefoxOptions chromeOptions = new FirefoxOptions();
WebDriver driver = null;
@BeforeTest
public void beforeTest() throws Exception
{
driver = new RemoteWebDriver(new URL("http://localhost:4444"), chromeOptions);
}
@Test
//Checking the title of iamNeo (Home - iamneo)
public void iamNeo() throws InterruptedException
{
// driver.manage().window().maximize();
driver.navigate().to("http://iamneo.ai/");
String title = driver.getTitle();
System.out.println(title);
Assert.assertEquals(title, "Learning and assessment solution for Universities and Enterprises");
}
@Test
//Moving to FACEBOOK
public void nextPage() throws InterruptedException
{
driver.navigate().to("https://www.facebook.com");
String title = driver.getTitle();
Assert.assertEquals(title, "Facebook – log in or sign up");
}
@Test
//Back to iamNeo
public void backPage() throws InterruptedException
{
driver.navigate().back();
String title = driver.getTitle();
System.out.println(title);
Assert.assertEquals(title, "Learning and assessment solution for Universities and Enterprises");
}
@Test
//Current URL
public void currentURL() throws InterruptedException
{
System.out.println(driver.getCurrentUrl());
String title = driver.getTitle();
System.out.println(title);
Assert.assertEquals(title, "Learning and assessment solution for Universities and Enterprises");
driver.navigate().forward();
driver.navigate().refresh();
}
@AfterTest
public void afterTest()
{
driver.quit();
}
:
It is Throwing Session Not created Exception :
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up :
org.openqa.selenium.SessionNotCreatedException:
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.1.0', revision: '87802e897b'
System info: host: 'eeeccebaefcebfacecbccfaabacdfdabdafecefecf-0', ip: '10.41.17.6', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.217+', java.version: '11.0.13'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {}}}]
Capabilities {}
at ai.iamneo.testing.Testing_Selenium_TestNg.AppTest.beforeTest(AppTest.java:24)
Caused by: java.lang.RuntimeException: NettyHttpHandler request execution error
at ai.iamneo.testing.Testing_Selenium_TestNg.AppTest.beforeTest(AppTest.java:24)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException: Request timeout to localhost/127.0.0.1:4444 after 180000 ms
at ai.iamneo.testing.Testing_Selenium_TestNg.AppTest.beforeTest(AppTest.java:24)
Caused by: ja
1条答案
按热度按时间wlwcrazw1#
取代:
您需要通过:
您可能需要在末尾追加 *
/wd/hub
*,如下所示:参考文献
您可以在以下位置找到相关的详细讨论: