Selenium,一次使用多个 firefoxProfileTemplates/从 selenium 对象指定而不是在服务器启动时指定?

发布于 2024-09-25 15:34:15 字数 368 浏览 2 评论 0原文

我正在使用 Selenium RC 进行网站测试,我需要一次使用多个代理,并且在启动 selenium 服务器时使用:firefoxProfileTemplate 来执行此操作。然而,这不允许我使用多线程 selenium,因为每个 selenium 对象仍然使用相同的 firefoxProfileTemplate,因此使用相同的代理(我使用 Python 来控制/与 selenium 交互),因为它们都具有相同的代理。

我想知道是否有一种方法可以在启动 selenium 对象/使用 selenium 打开网页时指定 firefoxProfileTemplate,而不是仅在启动服务器时指定。或者,有没有一种方法可以运行 selenium 服务器的多个实例并指定与哪个实例进行交互?感谢您的任何建议。

I am using Selenium RC for website testing and I need to use multiple proxies at once and am doing this using: firefoxProfileTemplate when I start the selenium server. This, however, doesn't allow me to multi-thread selenium as each selenium object still uses the same firefoxProfileTemplate, and therefore the same proxy, (I am using Python to control / interact with selenium) as they all have the same proxy.

I am wondering if there is a way to specify the firefoxProfileTemplate when I launch the selenium object / open a web page with selenium rather than just when I launch the server. Alternatively, is there a way to run multiple instances of the selenium server and specify which one to interact with? Thanks for any advice.

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

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

发布评论

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

评论(1

倦话 2024-10-02 15:34:15

由于 Selenium Rc 是启动浏览器的机制,因此执行您想要的操作的唯一方法是使用多个 rc 实例。启动时添加 -port #### 并为您的实例提供唯一的端口号。

当你创建一个 selenium 对象时,你会做 sel = Selenium('localhost', ####, '*firefox', 'http://foo.bar')

作为 Selenium 2 中的旁注这是 alpha 版本,您可以通过编程方式构建所有这些,因为不依赖 RC。

Since Selenium Rc is the mechanism to start browser the only way to do what you want is with multiple rc instances. When starting it add -port #### and give your instances unique port numbers.

When you create a selenium object you do sel = Selenium('localhost', ####, '*firefox', 'http://foo.bar')

As a side note in Selenium 2 which is in alpha you can build all of this programatically since there is no reliance on RC.

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