Selenium tests in java, I already explained here. Since I am not Java expert I need them to run also in .NET environment, idea is to create console application to parse few web pages, by automatizing Chrome. I am using this web site.
Download Selenium Client & WebDriver Language Bindings, in my case I downloaded this one. You will also need ChromeDriver, in my case I downloaded this one.
Start new project:
Choose console:
Add references to previously downloaded Selenium Client & WebDriver Language Bindings (in solution explorer right mouse button on References):
Browse:
In my case I decided to go on net40:
Add dll's:
In my case I decided to add also ChromeDriver to project, then I will not have explicitly to write path. Right click on the project and click add existing item:
Choose chrome driver:
Select chrome driver, choose properties:
In part Copy To Output Directory, choose Copy always. You can also choose copy if newer, but to avoid possible problems I decided to go like this:
Now I added following name spaces:
using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Support.UI;
Then in Main method add code like:
IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://www.milosev.com");
In line:
IWebDriver driver = new ChromeDriver();
You can also write something like:
IWebDriver driver = new ChromeDriver(@"C:\Users\myUserName\Downloads\chromedriver_win32");
Then you wouldn't need to add chrome driver into the project...
So, this is all you need to start parsing pages with Selenium. Example project download from here.