Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
针对SeleniumHQ Docker图像创建的Selenium网格的Selenium Python测试 简言之_Python_Testing_Docker_Selenium Grid - Fatal编程技术网

针对SeleniumHQ Docker图像创建的Selenium网格的Selenium Python测试 简言之

针对SeleniumHQ Docker图像创建的Selenium网格的Selenium Python测试 简言之,python,testing,docker,selenium-grid,Python,Testing,Docker,Selenium Grid,如何针对SeleniumHQ Docker映像创建的Selenium网格容器正确运行Python Selenium测试 我也在这里询问了SeleniumHQ 错误&日志 全部细节 我试过了,发现没有什么有用的 单机版正常 我成功地与对手竞争 -启动网格 -运行测试 但使用集线器+节点网格失败 虽然我没能与对手竞争 -启动网格 -运行测试 问题 我有兴趣测试Selenium网格容器,即从创建的hub+节点容器。多亏了 在安装python selenium 3.3.1之后,我可以确认我

如何针对SeleniumHQ Docker映像创建的Selenium网格容器正确运行Python Selenium测试

我也在这里询问了SeleniumHQ

错误&日志
全部细节 我试过了,发现没有什么有用的

单机版正常

我成功地与对手竞争

-启动网格

-运行测试

但使用集线器+节点网格失败

虽然我没能与对手竞争

-启动网格

-运行测试

问题

我有兴趣测试Selenium网格容器,即从创建的hub+节点容器。

多亏了

在安装python selenium 3.3.1之后,我可以确认我的测试现在可以正常工作

pip uninstall selenium ; pip install selenium==3.3.1
#!/usr/bin/env python2.7

SELENIUM_HUB_CH = 'http://localhost:4445/wd/hub' #hub created at file 's01b_start_selenium_standalone_grid.sh'
SELENIUM_HUB_FF = 'http://localhost:4446/wd/hub' #hub created at file 's01b_start_selenium_standalone_grid.sh'

#region webdriver loading
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driverCH = webdriver.Remote(
  command_executor=SELENIUM_HUB_CH,
  desired_capabilities=DesiredCapabilities.CHROME,
)
driverFF = webdriver.Remote(
  command_executor=SELENIUM_HUB_FF,
  desired_capabilities=DesiredCapabilities.FIREFOX,
)
#endregion webdriver loading

for driver in [driverCH, driverFF]:
  driver.get('http://www.google.com')
  print(driver.title)
docker run -d -p 4444:4444 --name selenium-hub selenium/hub:3.4.0-einsteinium
docker run -d --link selenium-hub:hub selenium/node-chrome:3.4.0-einsteinium
docker run -d --link selenium-hub:hub selenium/node-firefox:3.4.0-einsteinium
#!/usr/bin/env python2.7

SELENIUM_HUB = 'http://localhost:4444/wd/hub'

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driver = webdriver.Remote(
  command_executor=SELENIUM_HUB,
  desired_capabilities=DesiredCapabilities.CHROME,
)

driver.get('http://www.google.com')
print(driver.title)
pip uninstall selenium ; pip install selenium==3.3.1