我正在使用 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);
}