Created
July 11, 2015 09:59
-
-
Save angelovstanton/9d263e76d1b4257391a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IWebDriver Driver { get; set; } | |
public Process TorProcess { get; set; } | |
public WebDriverWait Wait { get; set; } | |
[TestInitialize] | |
public void SetupTest() | |
{ | |
String torBinaryPath = @"C:\Users\aangelov\Desktop\Tor Browser\Browser\firefox.exe"; | |
this.TorProcess = new Process(); | |
this.TorProcess.StartInfo.FileName = torBinaryPath; | |
this.TorProcess.StartInfo.Arguments = "-n"; | |
this.TorProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; | |
this.TorProcess.Start(); | |
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); | |
this.Driver = new FirefoxDriver(profile); | |
this.Wait = new WebDriverWait(this.Driver, TimeSpan.FromSeconds(60)); | |
} | |
[TestCleanup] | |
public void TeardownTest() | |
{ | |
this.Driver.Quit(); | |
this.TorProcess.Kill(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment