zoukankan      html  css  js  c++  java
  • Selenium Grid学习笔记

    安装jdk,selenium-server-standalone-xxx.jar,准备好各浏览器的驱动(主要是chromedriver和iedriver)

    1.启动hub
    java -jar selenium-server-standalone-2.53.0.jar -role hub

    2.启动node
      2.1)单独模式,如果是访问别的主机的浏览器,需要将localhost替换为对应主机名
    java -jar selenium-server-standalone-2.53.0.jar -role node -hub http://localhost:4444/grid/register
      2.2)通过json启动
    java -jar selenium-server-standalone-2.53.0.jar -role node -nodeConfig node-json-XXX.cfg.json

    {
      "capabilities":
        [
          {
            "browserName": "firefox",
            "version": 43,
            "maxInstances": 5,
            "seleniumProtocol": "WebDriver"
            "platform": WINDOWS
          },
      "configuration":
      {
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "maxSession": 5,
        "port": 5555,
        "host": localhost,
        "register": true,
        "registerCycle": 5000,
        "htbPort": 4444,
        "hubHost": localhost
      }
    }

      2.3)指定浏览器版本模式
    java -jar selenium-server-standalone-2.53.0.jar -role node -browser "seleniumProtocol=WebDriver, browserName=chrome, version=61, maxInstances=5, platform = WINDOWS" -port 8889 -hubHost localhost

      2.4)通过json注册多个浏览器、版本、系统等信息到node
    java -jar selenium-server-standalone-2.53.0.jar -role node -nodeConfig node-json-XXX.cfg.json

    {
      "capabilities":
        [
          {
            "browserName": "firefox",
            "version": 43,
            "maxInstances": 5,
            "seleniumProtocol": "WebDriver"
          },
          {
            "browserName": "chrome",
            "version": 61,
            "maxInstances": 5,
            "seleniumProtocol": "WebDriver"
          },
          {
            "browserName": "iexplore",
            "version": 9,
            "maxInstances": 4,
            "seleniumProtocol": "WebDriver"
          }
        ],
      "configuration":
      {
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "maxSession": 5,
        "port": 5555,
        "host": localhost,
        "register": true,
        "registerCycle": 5000,
        "htbPort": 4444,
        "hubHost": localhost
      }
    }


      2.5)启动Android的node
    java -jar selenium-server-standalone-2.53.0.jar -role node -browser "seleniumProtocol=WebDriver, browserName=android, version=4.4.2, maxInstances=1, platform=ANDROID" -port 8899 -hubHost localhost

    参考:http://www.cnblogs.com/zw520ly/p/5995708.html

  • 相关阅读:
    基于Oracle的Mybatis 批量插入
    java.lang.ClassCastException: com.sun.proxy.$Proxy32 cannot be cast to com.bkc.bpmp.core.cache.MemcachedManager
    理解 Mybatis的分页插件 PageHelper
    手机注册获取验证码的PHP代码
    php分页代码简单实现
    PHP简单漂亮的分页类
    PHP实现各种经典算法
    Vue 入门指南 JS
    php 经典的算法题你懂的
    WebService 之 WSDL文件 讲解
  • 原文地址:https://www.cnblogs.com/aikachin/p/7755109.html
Copyright © 2011-2022 走看看