如何在后台启动PhantomJS + Selenium窗口?

时间:2014-10-01 02:42:54

标签: c# selenium phantomjs

我在我的应用程序中使用selenium + phantomjs,但我想在后台启动我的应用程序,selenium和phantomjs窗口。我该怎么办?

我试过了:

PhantomJSOptions options = new PhantomJSOptions();
options.AddAdditionalCapability("start-maximized", false);
IWebDriver driver = new PhantomJSDriver(Environment.CurrentDirectory + @"\drivers", options);

1 个答案:

答案 0 :(得分:6)

var serviceJs = PhantomJSDriverService.CreateDefaultService(phantomPath);
serviceJs.HideCommandPromptWindow = true;

Instance = new PhantomJSDriver(serviceJs);