标签: selenium-grid

如何从命令提示符关闭selenium hub/grid

我启动Selenium hub从端口4444上的命令提示符启动Selenium Grid.现在我从其他命令提示符启动Selenium RC.

它向我显示错误消息"Selenium已在端口4444上运行.或者其他一些服务是......"

现在我无法启动Selenium RC.请帮我如何从命令提示符关闭/关闭集线器.

selenium selenium-grid selenium-rc

9
推荐指数
4
解决办法
3万
查看次数

使用Java和TestNG在WebDriver上同时在不同的操作系统和浏览器上执行测试

我在我的系统中配置了网格并编写了我的测试脚本.我可以在任何指定的操作系统和任何浏览器上运行我的测试,但一次只能在一个操作系统和一个浏览器上运行,而不是所有操作系统和所有浏 这就是我所做的.请告诉我如何配置它以便它可以在一次配置的OS中运行.

我使用Java的脚本如下:

import java.net.MalformedURLException;
import java.net.URL;
import org.junit.AfterClass;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.*;

public class GridWithWebdriver {

    public WebDriver driver;

    @Parameters({"browser"})
    @BeforeClass
    public void setup(String browser) throws MalformedURLException {
        DesiredCapabilities capability=null;

        if(browser.equalsIgnoreCase("firefox")){
            System.out.println("firefox");
            capability= DesiredCapabilities.firefox();
            capability.setBrowserName("firefox"); 
            capability.setPlatform(org.openqa.selenium.Platform.ANY);
            //capability.setVersion("");
        }

        if(browser.equalsIgnoreCase("iexplore")){
            System.out.println("iexplore");
            capability= DesiredCapabilities.internetExplorer();
            capability.setBrowserName("iexplore"); 
            capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);
            //capability.setVersion("");
        }

        driver = new RemoteWebDriver(<span class="IL_AD" id="IL_AD11">new URL</span>("http://localhost:4444/wd/hub"), capability);
        driver.navigate().to("http://google.com");

    }

    @Test
    public void test_first() throws InterruptedException{
        Thread.sleep(3000);
        WebElement search_editbox   =   driver.findElement(By.name("q"));
        WebElement search_button    =   driver.findElement(By.name("btnG"));
        search_editbox.clear();
        search_editbox.sendKeys("first");
        search_button.click();
    } …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-grid

9
推荐指数
1
解决办法
4486
查看次数

与Webdriver相比,Watir-Webdriver和Capybara是否存在性能问题?

我即将把我的测试自动化语言从Java改为Ruby(我有新工作,Ruby更适合技术堆栈).

我有很多Java和Webdriver的经验,但可以看到像Watir和Capybara这样的包装器在Ruby中的使用似乎比直接访问Webdriver API更多.

我对使用这样一个库的担忧是性能.我通常尝试将第三方网格(如Saucelabs)集成到我的测试框架中,但已经了解到,对于持续查找元素可能会对性能产生影响,缓存硒网元素对象非常重要.

如果我使用像Capybara这样的库,我是否会失去控制缓存策略的能力?我之前研究过Geb,发现该框架不断重新创建了webelements而不是缓存,并且在改变这种行为方面似乎缺乏灵活性.

我担心这些库可以帮助您避免编写样板代码,但代价是性能有效吗?

ruby selenium-grid capybara watir-webdriver selenium-webdriver

9
推荐指数
1
解决办法
1138
查看次数

Selenium Grid VS Jenkins

我正在使用TestNG框架来处理selenium webdriver脚本.我在奴隶机器中使用Jenkins定期运行它们.我不使用Selenium Grid.在运行webdriver自动化测试用例时,使用硒网格优于jenkins有什么优势?请澄清我的理解是否完全错误.

selenium-grid jenkins selenium-webdriver

9
推荐指数
3
解决办法
9487
查看次数

如何在硒中自动更新 chromeDriver 和 geckDriver

我在多个节点机器上设置了 selenium 网格,其中我在所有 selenium 节点机器上手动下载 chromeDriver 和 geckoDriver,并将它们分别用于 chrome 和 firefox 浏览器。

现在这里的 chrome 和 firefox 浏览器(在所有 selenium 节点机器上)设置为“自动更新”(这是必需的,因为我希望我的应用程序始终在最新的浏览器版本上进行测试),因为我的节点机器上的浏览器不断更新更常见的是,因为相应的驱动程序更新是一个手动过程,它迫使我登录到每个 selenium 节点机器并手动更新它们

这个过程可以自动化吗?

PS:我知道 dockerized selenium grid 可用于获取/拉取最新的浏览器图像及其驱动程序,但是从传统 selenium grid 切换到 dockerized selenium grid 是另一回事,需要一些时间来实现。

selenium selenium-grid selenium-chromedriver geckodriver

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

当我尝试通过Python远程连接到selenium网格时,在/ wd/hub/session上获得404

我可以在控制台下看到两个遥控器,但是当我尝试远程连接并执行某些操作时,它会失败并显示404.

from selenium import webdriver
browser = webdriver.Remote(
   command_executor='http://ec2-184-72-129-183.compute-1.amazonaws.com:4444/wd/hub',
   desired_capabilities={'browserName': 'firefox'})
browser.get('http://www.google.com')
browser.quit()
Run Code Online (Sandbox Code Playgroud)

抛出这个例外

Traceback (most recent call last):
  File "browser-shot.py", line 16, in <module>
    desired_capabilities={'browserName': 'firefox'})
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 62, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 104, in start_session
    'desiredCapabilities': desired_capabilities,
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 155, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 125, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: '<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>\n<title>Error 404 </title>\n</head>\n<body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>\n<p>RequestURI=/wd/hub/session</p><p><i><small><a href="http://jetty.mortbay.org/">Powered by Jetty://</a></small></i></p><br/>                                                \n<br/>                                                \n<br/>                                                \n<br/>                                                \n<br/>                                                \n<br/>                                                \n<br/>                                                \n<br/>                                                \n<br/>                                                \n<br/> …
Run Code Online (Sandbox Code Playgroud)

python selenium selenium-grid selenium-webdriver

8
推荐指数
1
解决办法
3331
查看次数

使用Selenium RemoteWebDriver运行PhantomJS时出错

我用它的默认启动命令启动了一个selenium grid hub,

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

我在它的webdriver模式下启动PhantomJS,在同一台机器上,比如

phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444
Run Code Online (Sandbox Code Playgroud)

当PhantomJS启动时,除了"All'OK'"消息之外什么都没有,

[INFO  - 2013-09-09T18:10:38.849Z] GhostDriver - Main - running on port 8080
[INFO  - 2013-09-09T18:10:38.850Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4444' using '127.0.0.1:8080'
[INFO  - 2013-09-09T18:11:47.164Z] HUB Register - register - Registered with grid hub: http://127.0.0.1:4444/ (ok)
Run Code Online (Sandbox Code Playgroud)

但是,如果我尝试使用该浏览器,请使用

driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                          desired_capabilities=DesiredCapabilities.PHANTOMJS)
Run Code Online (Sandbox Code Playgroud)

查看PhantomJS可执行文件的输出,

[INFO  - 2013-09-09T18:17:12.531Z] Session [0c5c9500-197c-11e3-8eed-b3b7a73965aa] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}
[INFO …
Run Code Online (Sandbox Code Playgroud)

python selenium selenium-grid phantomjs selenium-webdriver

8
推荐指数
1
解决办法
7049
查看次数

Selenium Grid Hub/Node Config的属性

我正在经历一个将我的Selenium Hub/Nodes升级到3.3版的过程.一切正常,但我想确保我有最佳配置...问题是我找不到任何地方的Hub/Node属性的完整列表.

我看了看:

这些文档仅通过示例配置列出了一些属性,但它们中没有一个看起来像一个完整的列表,更重要的是它们都没有实际说明这些属性的作用. 有关Selenium Hub/Nodes的配置属性的完整列表的文档在哪里?

selenium selenium-grid selenium-webdriver protractor

8
推荐指数
1
解决办法
8552
查看次数

GitLab CI上的Selenium Grid错误:转发新会话时出错用于设置功能的VM空池

由于关于GitLab CI配置和Selenium的文档通常很差,我正在寻求帮助.

按兴趣点配置:

gitlab.ci.yml:

image: node:7

variables:
  HUB_PORT_4444_TCP_ADDR: "selenium__hub"
  HUB_PORT_4444_TCP_PORT: "4444"

services:
  - selenium/hub:latest
  - selenium/node-phantomjs:latest

stages:
  - test

test:
  stage: test
  before_script:
    - apt-get update
    - apt-get install -y default-jdk default-jre
    - npm install -s -g @angular/cli@1.0.6
    - npm install -s
    - node ./node_modules/protractor/bin/webdriver-manager update
  script:
    - ./node_modules/.bin/protractor protractor.ci.conf.js
Run Code Online (Sandbox Code Playgroud)

protractor.ci.conf.js:

/*global jasmine */
const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './e2e/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'phantomjs',
    'phantomjs.binary.path': './node_modules/phantomjs-prebuilt/bin/phantomjs'
  },
  directConnect: false, …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-grid angularjs-e2e protractor gitlab-ci

8
推荐指数
1
解决办法
1002
查看次数

在Selenum网格上运行并行执行

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Parallel test suite" parallel="classes" thread-count="2">
  <test thread-count="1" name="Transactoin">
  <parameter name="remoteurl" value="http://xx.xx.xxx.xxx:5555/wd/hub"></parameter>
    <classes>
      <class name="POM_Test.ATransactionTest"/>
     </classes>
  </test> <!-- Test -->
  <test thread-count="1" name="MyAlerts">
  <parameter name="remoteurl" value="http://xx.xx.xx.xxx:5556/wd/hub"></parameter>
    <classes>
      <class name="POM_Test.MyAlertsTest"/>
    </classes>
  </test> 
</suite> <!-- Suite -->
Run Code Online (Sandbox Code Playgroud)

ATransactionTest Class47测试用例 MyAlertsTest Class具有40测试用例.

我想run both classes simulatneously,MyAlertsTest应该采用参数中给出的remoteurl,并且ATransaction测试应该在给定参数的情况下采用remoteurl.

但是,所发生的事情是,ATransactionTestNode1所有测试用例完成后,首先MyAlerts运行Node2.如何同时运行.

谢谢

selenium selenium-grid

8
推荐指数
1
解决办法
126
查看次数