Selenium IWebDriver Navigate().GoToUrl() not entering url or navigating to page
I figured it out right after I finally broke down and decided to post on StackOverflow. My issue was IWebDrivers
insists upon a passed in URL beginning with http
. Once I prefixed my URL with that, it worked.
Here is a simple example how to do so:
Add NuGet package Selenium.WebDriver
Download chromedriver (https://sites.google.com/a/chromium.org/chromedriver/) or any other driver from http://www.seleniumhq.org/download/ (section Third Party Browser Drivers NOT DEVELOPED by seleniumhq)
Copy the file to your project directory in Visual Studio and set the following properties for the file:
Build Action = None;Copy to Output Directory = Copy if newer
Once installed, try running the following example code:
var driver = new ChromeDriver();var navigate = driver.Navigate();navigate.GoToUrl("http://www.microsoft.com"); //worksnavigate.GoToUrl("www.microsoft.com"); //does not work
Good luck!
Also
navigate.GoToUrl("http:\\www.microsoft.com"); // "\\" instead of "//", wont worknavigate.GoToUrl("http://www.microsoft.com"); // that one works perfectly.
with backslashes instead of forward slashes wont work either... I've just spend about an hour, figuring this out.
URL address, correcly must be with forward slashes.