【问题标题】:Selenium script too slow with new FirefoxDriver()使用新的 FirefoxDriver() 时 Selenium 脚本太慢
【发布时间】:2015-05-08 16:55:43
【问题描述】:

我在特定网站(比如 xyz.com)上进行自动化操作。当我手动打开 URL 时,它会按预期让我进入登录页面,我也可以在那里登录。
但是,当我通过使用 new FirefoxDriver() 创建新的 Firefox 实例来自动化场景时,登录页面会快速打开,但是;当我点击登录按钮时,导航到主页需要将近 2 分钟。 我尝试使用新的配置文件,但没有帮助。 我在带有 Java(Eclipse) 的 MAC 上使用 Selenium 2.44.0。 请帮忙。

【问题讨论】:

标签: java testing selenium selenium-webdriver selenium-firefoxdriver


【解决方案1】:

Selenium 也有同样的问题。我最终做的是让 webdriver 使用预期条件等到页面标题更改(到主页)。

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.titleContains(": My Expected Page title"));

我建议你看看这里:

  1. driver.wait() throws IllegalMonitorStateException

    1. Wait for page load in Selenium

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-09
    • 1970-01-01
    相关资源
    最近更新 更多