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

exe not downloading into the designated folder #175

Closed
jdsimcock opened this issue May 1, 2022 · 1 comment
Closed

exe not downloading into the designated folder #175

jdsimcock opened this issue May 1, 2022 · 1 comment

Comments

@jdsimcock
Copy link

Related to issue #167 and the comment from Pookalton in that I need to have the driver download into a folder that the user has authority to write to. My deployed application installs into a sub-folder of the "Program Files (x86)" which after installation, the user does not have access to update. Therefore trying to download driver into a sub-folder of the Roaming Application folder, which the user can update. The folders are created by WebDriverManager but, the needed "msedgedriver.exe" does not appear.

var RoamingAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
RoamingAppDataPath += "myAppName\\EdgeDriver\\LATEST";

new WebDriverManager.DriverManager().SetUpDriver(
"https://msedgedriver.azureedge.net/LATEST_STABLE",
Path.Combine(RoamingAppDataPath, "msedgedriver.exe")
);

Also your README "Manual way" seems to show the now obsolete syntax i.e.

new DriverManager().SetUpDriver(
"https://chromedriver.storage.googleapis.com/2.25/chromedriver_win32.zip",
Path.Combine(Directory.GetCurrentDirectory(), "chromedriver.exe"),
"chromedriver.exe"
);

rather than the current supported syntax of

new DriverManager().SetUpDriver(
"https://chromedriver.storage.googleapis.com/2.25/chromedriver_win32.zip",
Path.Combine(Directory.GetCurrentDirectory(), "chromedriver.exe")
);

Really keen to get this working and to be able to make use of your otherwise very helpful code :-).

@jdsimcock
Copy link
Author

OK so I think this issue should be closed as I looked at one of the already closed issues and found some nice code and tried that in with mine and it worked. My working code in case that helps anyone else is:

IDriverConfig config = (IDriverConfig)Activator.CreateInstance(typeof(EdgeConfig));

string latestVersion = config.GetLatestVersion();
string url = config.GetUrl64().Replace("<version>", latestVersion);
string msEdgeDriverDirectoryName = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
msEdgeDriverDirectoryName += $"\\myAppName\\Edge\\{latestVersion}\\X64";
string binaryPath = Path.Combine(msEdgeDriverDirectoryName, config.GetBinaryName());

DriverManager mgr = new DriverManager();
mgr.SetUpDriver(url, binaryPath);

Thank you very much for this code as my app would not be possible without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant