2016-01-23 79 views
0

我想问问你:有没有什么办法可以运行在我的一个应用程序方法启动过程中打开的进程?
我正在写在WPF应用程序,这是我想在后台运行我的Firefox的驱动程序(硒):程序在后台打开应用程序

//create driver using existing profile 
IWebDriver driver = new FirefoxDriver(ffprof); 
//change a position (browser is invisible on the screen but after 1-2 sec since ff opened so 
//this is not a solution :(. And it exist on taskbar. 
driver.Manage().Window.Position = new System.Drawing.Point(-2000,0); 
//change webdriver url 
driver.Url = url; 
//Save this ff proces to variable 
Process ffProcess = HelpMethods.GetFirefoxProcess(); 

当Firefox将运行作为后台进程的另一个问题,我可以工作与它通常(例如更改网址或在网站上做某事)?

+0

你说的“在后台运行的意思“?隐藏的浏览器窗口? – Andrew

+0

过程启动时是隐藏窗口 – kamciono5

回答

1

你不能在windows中隐藏firefox应用程序。 但您可以使用PhantomJS网页浏览器。这是无头浏览器,你会得到你所需要的。

例如:您需要添加硒 How to implement PhantomJS with Selenium WebDriver using java

当你使用,C#phantomjs NuGet包到项目中。 如果您将使用控制台/表格应用程序代码(而不是在测试),你也需要做下面的隐藏phantomjs控制台窗口:

How can I start PhantomJS + Selenium window in background?

+0

你能告诉我我该怎么做? – kamciono5

+0

我已修复我的回复 – Andrew

+0

但我想在我已经创建的webdriver firefox个人资料中使用(我需要启动配置文件中的一些Firefox附加组件)。我可以做到吗? – kamciono5

相关问题