Reputation: 61
I am trying to open more then one instance of tor browser with different identities with c#.
One of the brwoswers opens fine:
But when the code opens the second I get empty browser:
Here is my c# code:
IWebDriver browser;
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.proxy.type", 1);
profile.SetPreference("network.proxy.socks", "127.0.0.1");
profile.SetPreference("network.proxy.socks_port", 9150);
browser = new FirefoxDriver(profile);
// browser.Quit();
//Firefox's proxy driver executable is in a folder already
// on the host system's PATH environment variable.
browser.Navigate().GoToUrl("http://dnsleaktest.com");
//IWebElement header = browser.FindElement(By.Id(“site - header"));
//Assert.True(header.Displayed);
// browser.Close();
Thread.Sleep(10000);
IWebDriver browser2;
FirefoxProfile profile2 = new FirefoxProfile();
profile2.SetPreference("network.proxy.type", 1);
profile2.SetPreference("network.proxy.socks", "127.0.0.1");
profile2.SetPreference("network.proxy.socks_port", 9152);
browser2 = new FirefoxDriver(profile2);
// browser.Quit();
//Firefox's proxy driver executable is in a folder already
// on the host system's PATH environment variable.
browser.Navigate().GoToUrl("http://dnsleaktest.com");
//IWebElement header = browser.FindElement(By.Id(“site - header"));
//Assert.True(header.Displayed);
// browser.Close();
Please correct my English if needed
Upvotes: 0
Views: 130
Reputation: 10765
Change this line:
//Firefox's proxy driver executable is in a folder already
// on the host system's PATH environment variable.
browser.Navigate().GoToUrl("http://dnsleaktest.com");
//IWebElement header = browser.FindElement(By.Id(“site - header"));
To this:
//Firefox's proxy driver executable is in a folder already
// on the host system's PATH environment variable.
browser2.Navigate().GoToUrl("http://dnsleaktest.com");
//IWebElement header = browser.FindElement(By.Id(“site - header"));
You were navigating the first browser object when you needed to be navigating the second browser object.
Upvotes: 1