safari上的webdriver在调试模式下运行良好,但在运行时无法正常工作

时间:2015-12-18 06:08:52

标签: java selenium-webdriver safari safaridriver

我使用Selenium Webdriver在Windows上测试safari浏览器,在调试模式下,我的脚本运行良好,但是当我运行它时,它无法正常工作。有没有人遇到过这种情况?

public class JustForTestSafari {

    public WebDriver driver;

    @Test
    public void f() {
        driver = new SafariDriver();

        String baseURL = "http://universitytest.emersonprocess.com/";
        String expectedTitle = "ProcessWorld - Your Connection to Global Information";
        WebDriverWait wait = new WebDriverWait(driver, 30);

        driver.get(baseURL);
        driver.manage().window().maximize();

        String actulTitle = driver.getTitle();
        Assert.assertEquals(expectedTitle, actulTitle);

        driver.findElement(By.id("_ctl0_mastercontent_username")).clear();
         driver.findElement(By.id("_ctl0_mastercontent_username")).sendKeys("***.guo");
        driver.findElement(By.id("_ctl0_mastercontent_password")).clear();
        driver.findElement(By.id("_ctl0_mastercontent_password")).sendKeys("*******");
        driver.findElement(By.id("_ctl0_mastercontent_btn_standardsignin")).click();
}

0 个答案:

没有答案