Rinktacular
Rinktacular

Reputation: 1126

Using Selenium in C# without opening a browser in Visual Studio 2013

I have been using Selenium along side C# in Visual Studio 2013. I will make a call to:

driver.Navigate().GoToUrl("http://<insert webpage>");

...Which will open whichever WebDriver I choose to use. From here, I will make calls to links/text boxes/menus as I need to. However, I was wondering if there is a way to get the information from webpages without having to actually open a browser, and if so, could someone perhaps explain or link me to the right direction? It would save time and speed up a lot of my programs. I know applications can get information remotely without actually opening a browser, I just do not know how the process works or if Selenium alone will give that ability.

I appologize if this is wrong place to ask this question.

Upvotes: 2

Views: 4555

Answers (1)

vmg
vmg

Reputation: 10576

It is not clear whether or not you need to work with web page (like click on the links, or edit test), but here are two options:

  1. You can use PhantomJS.It is headless browser and since there will be no UI execution may be faster. There is a selenium driver for it.
  2. You can use Html Agility Pack to parse the page and WebClient to download the page. No selenium is required in that case. Html Agility Pack will allow you to make XPath queries, find objects by class name or ID. But: you won't be able to manipulate with DOM structure as you can do with real browser. It is just to parse and navigate over static html page.

Upvotes: 4

Related Questions