小编Man*_*ria的帖子

设置selenium webdriver的默认执行速度

我正在用webdriver运行一些GUI测试.我直接从selenium IDE导出了一些测试.在这个测试中,我不得不降低IDE的运行速度,因为加载了下拉.如何在Selenium webdriver中减慢测试速度?我已经把

 driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
Run Code Online (Sandbox Code Playgroud)

它一直在快速运行.我知道睡眠选项,但这不是我想要的,我想改变webdriver的默认执行速度.这是我的代码:

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class ProfileCheck {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private final StringBuffer verificationErrors = new StringBuffer();

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://localhost:8080";
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
}

@Test
public void testProfileCheck() throws Exception …
Run Code Online (Sandbox Code Playgroud)

java user-interface selenium selenium-ide selenium-webdriver

3
推荐指数
2
解决办法
2万
查看次数