Selenium Grid Hub 和节点问题

Selenium Grid Hub and Nodes Issue

HELPPPP 请注意!

现在我已经使用以下方法设置了 selenium 网格:

-机器A上面有hub和node(和hub在同一台机器的nod​​e)。 -机器B(不同的机器比集线器不一样),上面有2个节点。

因此我现在有一个集线器和 3 个节点:1 个在集线器机器(机器 A)上也充当节点,2 个在另一个物理节点机器(机器 B)上。

因此,通过此设置,我可以 运行 并行 AFAIK 3 个测试用例。

我所做的一切我都会提供帮助。

集线器的设置命令:

java -jar selenium-server-standalone-3.0.0-beta2.jar -role hub -port 4445

(我更改了默认的端口号)

节点设置命令:

java -jar -Dwebdriver.ie.driver="C:\Libraries\IEDriverServer.exe" -Dwebdriver.chrome.driver="C:\Libraries\chromedriver.exe" selenium-server-standalone-3.0.0-beta2.jar -role webdriver -hub http://HubIP:4445/grid/register -port 4453

然后是用于设置和测试的 C# 代码:

     using System;
     using OpenQA.Selenium;
     using OpenQA.Selenium.Firefox;
     using OpenQA.Selenium.Chrome;
     using OpenQA.Selenium.Safari;
     using OpenQA.Selenium.Edge;
     using OpenQA.Selenium.IE;
     using OpenQA.Selenium.Support.UI;
     using OpenQA.Selenium.Remote;
     using NUnit;
     using NUnit.Framework;
     using System.Collections.Generic;
     using System.Linq;
     using System.Text;
     using System.Threading;
     using System.Threading.Tasks;


    namespace GridTest
         {
    [TestFixture]
    [Parallelizable]
    public class Grid_Test
    {
        private IWebDriver driver;
        [SetUp]
        public void Setup()
        {


            ///Chrome setup///
          DesiredCapabilities capabilities = new DesiredCapabilities();
          capabilities = DesiredCapabilities.Chrome();
          capabilities.SetCapability(CapabilityType.BrowserName, "chrome");
          capabilities.SetCapability("marionette", false);
          capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Any));
          driver = new RemoteWebDriver(new Uri("http://10.10.17.223:4445/wd/hub"), capabilities);

        }



        [Test]

        [Parallelizable]
        public void SeleniumSearch()
        {
            //var driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://www.seleniumhq.org/");

        }

        [TearDown]
        public void Teardown()
        {

            driver.Quit();
        }
    }

    [TestFixture]
    [Parallelizable]
    public class Test_Grid2
    {
        IWebDriver driver2;
        [SetUp]
        public void Setup()
        {

            ///Chrome setup///
           DesiredCapabilities capabilities = new DesiredCapabilities();
           capabilities = DesiredCapabilities.Chrome();
           capabilities.SetCapability(CapabilityType.BrowserName, "chrome");
           capabilities.SetCapability("marionette", false);
           capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Any));
           driver2 = new RemoteWebDriver(new Uri("http://10.10.17.223:4445/wd/hub"), capabilities);
        }


        [Test]
        [Parallelizable]
        public void BingSearch()
        {
            //var driver = new FirefoxDriver();
            driver2.Navigate().GoToUrl("http://www.bing.com");

        }


        [TearDown]
        public void Teardown()
        {
            driver2.Quit();
        }
    }

    [TestFixture]
    [Parallelizable]
    public class Test_Grid3
    {
        IWebDriver driver3;
        [SetUp]
        public void Setup()
        {



            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities = DesiredCapabilities.Chrome();
            capabilities.SetCapability(CapabilityType.BrowserName, "chrome");
            capabilities.SetCapability("marionette", false);
            capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Any));
            driver3 = new RemoteWebDriver(new Uri("http://10.10.17.223:4445/wd/hub"), capabilities);


        }


        [Test]
        [Parallelizable]
        public void SeleniumSearch()
        {
            //var driver = new FirefoxDriver();
            driver3.Navigate().GoToUrl("http://www.seleniumhq.org/");

        }

        [TearDown]
        public void Teardown()
        {
            driver3.Quit();
        }
    }

}

我现在有两个主要问题:

1) 当我 运行 测试时,它应该 运行 并行进行 3 个测试,这不会发生,只有 2 个测试 运行 同时发生,我不不知道为什么。

2) 测试不会在 chrome 浏览器上 运行,它只会打开页面,测试不会继续。命令中的错误说: Chrome 启动失败:崩溃。

知道问题出在哪里吗??

非常感谢。

编辑
- 第二个问题通过卸载重装chrome解决。不知道旧版浏览器有什么问题。

EDIT2 - 还解决了第一个问题,我知道这里的网格社区和 Nunit 都很差,运行ning 2 次测试的问题只是因为 LevelOfParallelism[=55 的默认值=] 属性 所以要并行地将测试数量增加到 运行,请将其写入 assemblyInfo.cs 文件 [程序集:LevelOfParallelism(X)] 其中 X 可以 运行.

的并行线程数

Is running multiple tests related to the number of cores of the hub ONLY ?? cause if so my hub is only 2 cores so maybe this would be the case. but this makes a very limited restriction that the hub must have a lot of cores. i want to ask since the node can have by default 11 instances(5 chrome,5 FF, 1 IE), would it be able to run 11 test cases in parallel on those instances ??!

  • 第二个问题卸载重装chrome解决。不知道旧版浏览器有什么问题。

  • 解决了第一个问题 另外,我知道这里的 grid 社区和 Nunit 都很差,运行ning 的问题2 次测试只是因为 LevelOfParallelism 属性的默认值所以要将测试数量增加到 运行 并行写入 assemblyInfo.cs 文件 [assembly: LevelOfParallelism(X)] 其中 X 可以 运行.

  • 的并行线程数