Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#22-hide-command-prompt #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions CodingBrowser/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@ namespace CodingBrowser
{
public class Browser
{
public WebDriver driver;
private WebDriver driver;

Thread InstanceCaller;
private Thread InstanceCaller;

private Browser(string url)
{
var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

var dm = new DriverManager(appDataPath + @"\CodinGameExtension");

var binary = dm.SetUpDriver(new FirefoxConfig());

var binaryFI = new FileInfo(binary);

//option Eager => DOM access is ready, but other resources like images may still be loading
driver = new FirefoxDriver(binaryFI.DirectoryName, new FirefoxOptions() { PageLoadStrategy = PageLoadStrategy.Eager });

string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CodinGameExtension");
DriverManager dm = new DriverManager(appDataPath);
string binary = dm.SetUpDriver(new FirefoxConfig());
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(Path.GetDirectoryName(binary));
#if !DEBUG
service.HideCommandPromptWindow = true;
#endif
driver = new FirefoxDriver(service, new FirefoxOptions
{
//option Eager => DOM access is ready, but other resources like images may still be loading
PageLoadStrategy = PageLoadStrategy.Eager,
});
driver.Navigate().GoToUrl(url);

if (CookieManager.CookieFileExist())
Expand All @@ -41,7 +42,6 @@ private Browser(string url)
InstanceCaller.Start();
}


private void CookieChecker()
{
string url = "";
Expand All @@ -55,7 +55,6 @@ private void CookieChecker()
{
url = driver.Url;
CheckCookie();

}
}
}
Expand Down
Loading