硒服用>命令之间的分钟数

发布于 2024-09-29 20:14:17 字数 1405 浏览 2 评论 0原文

Selenium 似乎在每个步骤之间暂停大约一分钟(我没有见过少于 60 秒的)。即使是简单的步骤(如 setSpeed)也以相同的速率运行。

但是,当我使用 PHPUnit_Extensions_SeleniumTestCase 类时,我能够以正常速度运行测试。 (此外,缓慢的步骤在同事的计算机上运行良好。)

有人知道我做错了什么吗?谢谢!

这是慢速测试:

debug_time(); // 0

require_once 'Testing/Selenium.php';
debug_time(); // 1

$s = new Testing_Selenium('*firefox', "http://google.com/");
debug_time(); // 2

$s->setSpeed(0);
debug_time(); // 3

$s->start();
debug_time(); // 4

var_export($s->getSpeed());
echo "\n";
debug_time(); // 5

$s->open('/');
debug_time(); // 6

$s->stop();
debug_time(); // 7

echo "done";

这是慢速测试的输出:

0 => 18:01:54.44488 (+ 0.00000)
1 => 18:01:54.45478 (+ 0.00990)
2 => 18:01:54.45645 (+ 0.00167)
3 => 18:02:54.97334 (+ 60.51688)
4 => 18:04:03.59346 (+ 68.62013)
NULL
5 => 18:05:04.11214 (+ 60.51867)
6 => 18:06:05.83747 (+ 61.72534)
7 => 18:07:06.63492 (+ 60.79744)
done

这是快速测试,取自 PHPUnit 手册:

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp()
    {
        $this->setBrowser('*firefox');
        $this->setBrowserUrl('http://google.com/');
    }

    public function testTitle()
    {
        $this->open('/');
        $this->assertTitleEquals('Example Web Page');
    }
}

Selenium seems to be pausing for about a minute between each step (I haven't seen less than 60 seconds). Even steps that should be simple (like setSpeed) run at the same rate.

However, when I use the PHPUnit_Extensions_SeleniumTestCase class, I am able to run tests at normal speed. (Also, the slow steps run fine on a coworker's computer.)

Anyone know what I'm doing wrong? Thanks!

Here is the slow test:

debug_time(); // 0

require_once 'Testing/Selenium.php';
debug_time(); // 1

$s = new Testing_Selenium('*firefox', "http://google.com/");
debug_time(); // 2

$s->setSpeed(0);
debug_time(); // 3

$s->start();
debug_time(); // 4

var_export($s->getSpeed());
echo "\n";
debug_time(); // 5

$s->open('/');
debug_time(); // 6

$s->stop();
debug_time(); // 7

echo "done";

Here is the output for the slow test:

0 => 18:01:54.44488 (+ 0.00000)
1 => 18:01:54.45478 (+ 0.00990)
2 => 18:01:54.45645 (+ 0.00167)
3 => 18:02:54.97334 (+ 60.51688)
4 => 18:04:03.59346 (+ 68.62013)
NULL
5 => 18:05:04.11214 (+ 60.51867)
6 => 18:06:05.83747 (+ 61.72534)
7 => 18:07:06.63492 (+ 60.79744)
done

Here is the fast test, taken from the PHPUnit manual:

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp()
    {
        $this->setBrowser('*firefox');
        $this->setBrowserUrl('http://google.com/');
    }

    public function testTitle()
    {
        $this->open('/');
        $this->assertTitleEquals('Example Web Page');
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ㄟ。诗瑗 2024-10-06 20:14:17

这里也一样。降级到Testing_Selenium-0.4.3 有帮助。正在努力寻找原因。可能是PHP5.3?

The same here. Downgrade to Testing_Selenium-0.4.3 helped. Trying to find the reason. May be PHP5.3?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文