driver.navigate()。back()在Intellij中无法在Java中工作
我正在尝试使用Back()方法使用Back()方法。使用Intellij和Chromedriver。但是back()方法在这里失败。
我的代码如下,
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
public class test {
public static WebDriver driver;
@BeforeTest
public void initiateAction()
{
System.setProperty("webdriver.chrome.driver","D:\\Automation\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
}
@Test
public void Login() throws InterruptedException {
driver.get("https://www.guru99.com/page-object-model-pom-page-factory-in-selenium-ultimate-guide.html");
Thread.sleep(3000);
driver.get("https://www.sportsmediawatch.com/nba-tv-schedule/");
Thread.sleep(3000);
driver.manage().timeouts().implicitlyWait(3000,TimeUnit.SECONDS);
driver.navigate().back();
Thread.sleep(5000);
driver.quit();
}
}
I'm trying to get back to previous page by using back() method using. using intellij and chromedriver. But back() method is failing here..
My code is as follows,
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
public class test {
public static WebDriver driver;
@BeforeTest
public void initiateAction()
{
System.setProperty("webdriver.chrome.driver","D:\\Automation\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
}
@Test
public void Login() throws InterruptedException {
driver.get("https://www.guru99.com/page-object-model-pom-page-factory-in-selenium-ultimate-guide.html");
Thread.sleep(3000);
driver.get("https://www.sportsmediawatch.com/nba-tv-schedule/");
Thread.sleep(3000);
driver.manage().timeouts().implicitlyWait(3000,TimeUnit.SECONDS);
driver.navigate().back();
Thread.sleep(5000);
driver.quit();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论