Selenium Grid c# - 在节点机器中运行多个浏览器

时间:2016-07-15 21:05:18

标签: c# selenium remotewebdriver selenium-grid2

我使用selenium Grid在c#中自动化我的测试用例,我将集线器作为我的windows机器,我的节点是MAC。我想在节点机器上运行多个浏览器,比如Firefox,Chrome,Safari。

我的中心命令行是

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

我的节点命令行是

enjava -jar selenium-server-standalone-2.48.2.jar -Dwebdriver.chrome.driver="chromedriver.exe" -role node -hub http://ip:4444/grid/register -port 4507 -browser browserName=chrome maInstances=5, maxSessoin=5 -browser browserName=firefox maxInstances=5, maxSessoin=5 -browser browserName=safari maxInstances=5, maxSessoin=5

我的C#代码段

    public static RemoteWebDriver Instance { get; set; }
    public static void Initialize()
    {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities = DesiredCapabilities.Firefox();
        capabilities = DesiredCapabilities.Chrome();
        capabilities = DesiredCapabilities.Safari();
        capabilities.SetCapability(CapabilityType.BrowserName, "firefox");
        capabilities.SetCapability(CapabilityType.BrowserName, "chrome");
        capabilities.SetCapability(CapabilityType.BrowserName, "safari");
        capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Mac));
        Instance = new RemoteWebDriver(new Uri("http://ip:4507/wd/hub"), capabilities);

    }

0 个答案:

没有答案
相关问题