2

I am testing opening multiples "Save as" dialog browser windows to make sure each dialog will download the correct file. As a workaround I am sending user's keyboard keys to control a dialog. But it only works for one dialog with the focused window.

IWebElement element = driver.FindElement(By.Id("uploadhere"));
element.SendKeys("C:\\Some_Folder\\MyFile.txt");

Is there a way to switch or select a specific "Save as" dialog?

1

I would try to disable the save as functionality:

ChromeOptions options = new ChromeOptions();
options.AddUserProfilePreference("download.default_directory", @"C:\Users\Usernname\Downloads\");
options.AddUserProfilePreference("download.prompt_for_download", false);
driver = new ChromeDriver(options);

Now files will be directly downloaded, without the save as dialog.

Firefox has a similar setting: browser.helperApps.neverAsk.saveToDisk

0

Easiest way is to use Keyboard keys. You can use

tab key

to navigate on the elements or the other dialog windows. This will work 100%.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.