如何同时运行多个Selenium Firefox浏览器?

2024-09-27 02:25:37 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试在使用Selenium的同一台计算机上同时运行多个进程。会发生这样的事情:

python my_selenium_process1.py &
python my_selenium_process2.py &
python my_selenium_process3.py &

据我所能测试的,这导致Selenium按顺序打开Firefox实例,这不是期望的行为。

附加说明:根据this question on superuser about multiple Firefox instances,方法是使用Firefox的--no-remote启动标志。这似乎是一个很好的方法,但我不确定是否有一个更简单的方法来做到这一点,或者这是否就是我正在寻找的。

编辑:目的不仅仅是加速特定的测试用例,而是允许多个Selenium进程同时运行。

非常感谢!任何建议将不胜感激!


Tags: 实例方法py进程顺序myselenium计算机
3条回答
sudo easy_install -U python-wd-parallel

那么

检查这里的用法

https://github.com/OniOni/python-parallel-wd

您可以使用Selenium Grd 2

  • 它允许通过在多台机器上分布测试来扩展(并行执行) Check Out here

你考虑过实现一个selenium grid吗?

Selenium Grid将通过并行运行测试来帮助您进行扩展。只需使用以下命令设置集线器和节点:

对于集线器

java -jar selenium-server-standalone-2.30.0.jar -role hub

对于节点

java -jar selenium-server-standalone-2.30.0.jar -role node  -hub http://localhost:4444/grid/register

相关问题 更多 >

    热门问题