标签: selenium-grid

如何配置Capybara在dockerized Selenium Grid中运行测试?

我有一套测试,我想在dockerized Selenium Grid中执行.测试是使用RSpec和Capybara用Ruby编写的.另外值得注意的是:我正在使用小艇作为码头机的包装机.

几周前,我建立了一个概念验证,但使用Nightwatch而不是RSpec + Capybara.这很好但是让Capybara与dockerized Selenium Grid一起工作已经证明是困难的.

我尝试了很多配置而没有成功.我认为最接近成功配置的是以下......

# docker-compose.yml

web:
  image: web:latest  # built on my machine
  environment:
    VIRTUAL_HOST: app.under.test

rspec:
  build: .
  dockerfile: Dockerfile
  environment:
    APP_HOST: app.under.test
  volumes:
    - .:/usr/src/app
  links:
    - web
    - hub

hub:
  image: selenium/hub:latest
  environment:
    VIRTUAL_HOST: selenium.hub.docker
  ports:
    - 4444:4444

node-firefox:
  image: selenium/node-firefox:latest
  environment:
    VIRTUAL_HOST: firefox.docker
  links:
    - hub

node-chrome:
  image: selenium/node-chrome:latest
  environment:
    VIRTUAL_HOST: chrome.docker
  links:
    - hub
Run Code Online (Sandbox Code Playgroud)
# Dockerfile for the rspec image

FROM instructure/ruby-passenger:2.3

USER root

ENV …
Run Code Online (Sandbox Code Playgroud)

rspec selenium-grid capybara docker-compose dinghy

15
推荐指数
1
解决办法
4689
查看次数

有没有人找到并行运行C#Selenium RC测试的方法?

有没有人找到一种方法来运行Selenium RC/Selenium Grid测试,用C#并行编写?

我目前使用Selenium RC的C#驱动程序编写了一个相当大的测试套件.运行整个测试套件需要一个多小时才能完成.我通常不需要运行整个套件,因此到目前为止它还没有引起关注,但我希望能够更频繁地进行操作(例如,作为自动构建的一部分)

我最近花了一些时间来讨论Selenium Grid项目,其目的主要是允许这些测试并行运行.不幸的是,似乎我正在使用的TestDriven.net插件连续运行测试(即,一个接一个).我假设NUnit会以类似的方式执行测试,虽然我实际上没有测试过.

我注意到NUnit 2.5测试版开始讨论与pNUnit并行运行测试,但我还没有真正熟悉这个项目,以确定这是否可行.

我正在考虑的另一个选择是将我的测试套件分成不同的库,这样我就可以同时从每个库中运行测试,但是我想尽可能避免这种情况,因为我不相信这是分裂的正当理由.测试套件.

c# selenium selenium-grid acceptance-testing pnunit

14
推荐指数
2
解决办法
5420
查看次数

Selenium 2 Grid - 了解您的测试使用的节点

是否有可能知道selenium网格集线器为您的测试分配了哪个节点?我的测试需要与节点机器上的其他服务进行通信,以便执行selenium不支持的配置.

标记

selenium-grid selenium-webdriver

13
推荐指数
1
解决办法
7164
查看次数

在Ubuntu上启动Firefox时,Selenium挂起

我的最终目标是让Selenium在Jenkins内部运行.我的Jenkins安装在Ubuntu虚拟机中运行.

在jenkins selenium设置的一些问题(源自jenkins运行的用户的权限)之后,我切换到从命令行运行命令以查看发生了什么.我的目标是让测试在这里运行,然后让它在Jenkins中运行.

这是我正在使用和看到的命令和响应.

resn@resn-VirtualBox:~$ sudo java -jar /var/lib/jenkins/tools/selenium/selenium-server.jar -htmlSuite *firefox http://google.com "/var/lib/jenkins/jobs/Selenium setup test/workspace/tests/test-testsuite.html" "/var/lib/jenkins/jobs/Selenium setup test/workspace/results/results.html" -log=/tmp/selenium.log -debug=true -firefoxProfileTemplate "/home/resn/.mozilla/firefox/6f2um01h.Selenium"

23/08/2011 11:19:51 AM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
11:19:52.172 INFO - Java: Sun Microsystems Inc. 19.0-b09
11:19:52.173 INFO - OS: Linux 2.6.35-28-generic i386
11:19:52.223 INFO - v2.4.0, with Core v2.4.0. Built from revision 13337
11:19:52.488 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:19:52.491 INFO - Version Jetty/5.1.x
11:19:52.491 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:19:52.501 INFO - …
Run Code Online (Sandbox Code Playgroud)

java ubuntu firefox selenium selenium-grid

11
推荐指数
1
解决办法
9659
查看次数

如何增加Selenium网格会话超时?

在运行我的测试时,我需要长时间延迟(约40秒).

而且我看到,Selenium会话在此期间被删除了.

请帮忙:如何配置会话超时增加?

这是我在Selenium节点日志中开始延迟后30秒内看到的内容:

INFO org.openqa.selenium.remote.server.DriverServlet - 会话7f5fffec-4882-4c4c-b091-c780c66d379d由于客户端超时而被删除

睡眠40秒后,我的代码中出现此异常:

org.openqa.selenium.remote.SessionNotFoundException

我试图增加所有可能的超时.以下是我启动集线器的方法:

java -jar selenium-server-standalone.jar -role hub 
-hubConfig selenium_hub.json 
-nodeTimeout 61 
-remoteControlPollingIntervalInSeconds 180 
-sessionMaxIdleTimeInSeconds 240 
-newSessionMaxWaitTimeInSeconds 250 
-timeout 59
Run Code Online (Sandbox Code Playgroud)

这里是selenium_hub.json:

{
  "host": null,
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets": [],
  "prioritizer":  null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,
  "cleanUpCycle": 5000,
  "timeout": 60000,
  "browserTimeout": 60000,
  "maxSession": 5,
  "jettyMaxThreads": -1
}
Run Code Online (Sandbox Code Playgroud)

没有在节点上配置任何超时.这是我在网格控制台中看到的内容:

browserTimeout : 60000
capabilityMatcher : org.openqa.grid.internal.utils.DefaultCapabilityMatcher
cleanUpCycle : 5000
host : null
hubConfig : /usr/local/selenium/config/selenium_hub.json
jettyMaxThreads : -1
maxSession : 5
newSessionMaxWaitTimeInSeconds …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-grid session-timeout selenium-webdriver

11
推荐指数
1
解决办法
2万
查看次数

RemoteWebDriver Chrome - 启动最大化

当通过硒网格运行时,我需要镀铬来开始最大化.

这是我现在如何初始化它:

Selenium selenium = new DefaultSelenium("localhost", 4444, "*googlechrome", "http://www.google.com");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
Run Code Online (Sandbox Code Playgroud)

Chrome确实出现了,但没有最大化.在通常的ChromeDriver中,我这样做了

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
Run Code Online (Sandbox Code Playgroud)

但我不知道如何将它传递给RemoteWebDriver.有人可以帮忙吗?

selenium webdriver selenium-grid

10
推荐指数
1
解决办法
2万
查看次数

无法从CMD打开Selenium Jar文件.路径或ClassPath问题?

我正试图推出:

java -jar selenium-server-standalone-2.14.0.jar -role hub
Run Code Online (Sandbox Code Playgroud)

从我的命令提示符,但输出如下:

C:\Program Files (x86)>java -jar selenium-server-standalone-2.14.0.jar -role hub

Unable to access jarfile selenium-server-standalone-2.14.0.jar
Run Code Online (Sandbox Code Playgroud)

C:\ Program Files(x86)是jar文件所在的位置.

我把C:\ Program Files(x86)放在我的PATH和CLASSPATH中,它仍然无法正常工作.

cmd path selenium-grid classpath executable-jar

10
推荐指数
1
解决办法
2万
查看次数

如何在不同的xvfb屏幕上运行selenium服务器会话?

我的问题是如何从SeleniumServer浏览器实例中获取隔离的视频流.让我解释.

我在Ubuntu Server机器上运行Selenium Server集线器,在同一服务器上运行Selenium Server节点,因此我使用xvfb使用'无头'Selenium模式.我像这样运行节点:DISPLAY=:99 java -jar selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register

然后我想获得在那里运行的测试的视频流,所以我安装了连接到xvfb虚拟显示器的x11server,之后我可以使用VNC连接那些远程服务器,我看到我的测试处理.问题是节点内的所有浏览器实例都在同一虚拟显示器上呈现(#99),当我需要同时运行多个测试时,我看到许多浏览器实例逐个重叠.但我想记录错误测试视频流,所以我不能这样做.所以我需要有可能连接到每个浏览器虚拟显示器.

我想我可以通过调整xvfb服务器以某种方式强制它为每个客户端(在我的情况下是浏览器实例)创建隔离的虚拟显示或屏幕(xvfb有多屏支持,不是吗?)来解决这个问题.但我试图这样做,但我没有得到结果.如果有必要解决这个问题,我还可以使用另一个虚拟显示器(不是xvfb).

请帮助我从每个浏览器实例中获取孤立的视频流:)非常感谢并对我的英语感到抱歉.

selenium selenium-grid selenium-rc selenium-webdriver

10
推荐指数
1
解决办法
4711
查看次数

在Selenium Grid中注册PhantomJS节点时出错

我有以下问题

  • 我成功推出了Selenium Grid hub:

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

  • 之后我尝试使用以下命令启动PhantomJS节点:

phantomjs --webdriver=8090 --webdriver-selenium-grid-hub=http://localhost:4444


但得到了错误:

[INFO - 2016-03-25T13:56:28.397Z] GhostDriver -主-端口运行8090 [INFO - 2016-03-25T13:56:28.397Z] GhostDriver -主-注册到硒HUB' 的http://本地主机:4444 '版本:使用'127.0.0.1:8090'与org.openqa.grid.selenium.proxy.DefaultRemoteProxy作为远程代理.[错误- 2016-03-25T13:56:28.400Z] GhostDriver - main.fail - { "线":97, "sourceURL": "phantomjs://platform/hub_register.js", "堆":"寄存器@ phantomjs://platform/hub_register.js:97:79 \nglobal code @ phantomjs://code/main.js:78:37"}

phantomjs://platform/console++.js:263错误

标准节点工作正常,但PhantomJS失败了.我做错了什么?

java selenium-grid phantomjs selenium-webdriver ghostdriver

10
推荐指数
2
解决办法
3927
查看次数

Selenium RemoteWebDriver c# - System.InvalidOperationException

我有一个使用Selenium.WebDriver v3.4.0的示例UI测试项目.

当我针对本地驱动程序运行测试时,一切正常,但我想使用Selenium Grid 2来完成工作.

一旦我尝试实例化一个新的RemoteWebDriver,我就会得到一个细节很少的异常.

Driver = new RemoteWebDriver(new Uri(GridUrl), Capabilities);     
Run Code Online (Sandbox Code Playgroud)

注意:GridUrl是" http:// localhost:4444/wd/hub "

使用StackTrace引发System.InvalidOperationException,如下所示:

   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
   at xxxx.Ui.Tests.SeleniumTests.TestInitialize() in C:\Users\xxxx\Documents\Visual Studio 2015\Projects\xxxx.Ui.Tests\xxxx.Tests\PersonTests.cs:line 38
Run Code Online (Sandbox Code Playgroud)

集线器配置

我在本地运行的集线器v3.4.0具有以下配置:

{
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {},
  "capabilityMatcher":"org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "cleanUpCycle": 5000,
  "role": "hub",
  "debug": false,
  "browserTimeout": 0,
  "timeout": 1800
}
Run Code Online (Sandbox Code Playgroud)

Hub始于:

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

这已经确定并且看起来正在运行. …

c# selenium selenium-grid remotewebdriver

10
推荐指数
1
解决办法
7012
查看次数