Reputation: 143
Have gone through previous post, but the error I am facing is different. Trying to open chrome through webdriver using C#.
namespace HelloWorld
{
public class OurFirstTest
{
static void main(String[] args)
{
IWebDriver driver = new ChromeDriver(@"D:\Automation\chromedriver");
driver.Navigate().GoToUrl("http://www.google.com");
}
}
}
During build, command prompt opens with message
Starting ChromeDriver <v2.9.248315> on port 9515.
Browser is not opening....
Upvotes: 1
Views: 9065
Reputation: 128
I Edited my code and you can follow it now, I am using this code to run chrome instance in incognito mode.
IWebDriver driver1;
ChromeOptions m_Options = new ChromeOptions();
m_Options.AddArgument("--user-data-dir=C:/Users/dell/AppData/Local/Google/Chrome/User Data/Profile 2");
m_Options.AddArgument("--disable-extensions");
m_Options.AddArgument("--silent");
m_Options.AddArgument("--incognito");
//Adding a Proxy
Proxy proxy = new Proxy();
proxy.HttpProxy = "XXXX.XXX.X.X:XXXX";
m_Options.Proxy = proxy;
driver1 = new ChromeDriver(@"F:\\ChromeDriver\", m_Options);
driver1.Navigate().GoToUrl("https://www.google.com");
Upvotes: 1
Reputation: 3718
Make sure you set up the right path for driver. You'd better put your chromediver in the same directory with your test's exe file.
And update your chromedriver to the latest version which is 2.10
Upvotes: 0