如何使用 Python + Webdriver 远程连接 [英] How do you connect remotely using Python + Webdriver
本文介绍了如何使用 Python + Webdriver 远程连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想弄清楚如何连接到我的远程 webdriver 实例.
I am trying to figure out how to connect to my remote webdriver instance.
这是我目前使用的代码:
This is the code I am currently using:
from selenium.remote.webdriver import WebDriver
driver = WebDriver("http://172.16.205.129:4444", "firefox", "ANY")
driver.get('http://google.com')
driver.quit()
我发现我无法连接并且连接被拒绝,或者如果我玩弄代码,偶尔会超时.
I find that I can't connect and will get a connection refused, or if i play around with the code, occasionally a time out.
感谢任何帮助.
推荐答案
您需要确保在测试之前设置 selenium
服务器集线器和节点.请参考此.
You need to ensure selenium
server hub and node are set up before the test. Please refer to this.
集线器运行示例
java -jar selenium-server-standalone-2.5.0.jar -role hub
节点连接到集线器的示例,运行
Example on node to connect to hub ,run
java -jar selenium-server-standalone-2.5.0.jar -role webdriver -hub
http://localhost:4444/grid/register -port 5555
您可以拥有任意数量的节点.
You can have as many nodes as you want.
这篇关于如何使用 Python + Webdriver 远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文