0

I have a Driver that clicks a Browse button on the page which opens a Open File Dialog. As of now, I am doing a Thread.Sleep(2000) but is there a way to figure out when the dialog has opened?

[Fact]
public void UploadDoc()
{
   UploadButton.Click();

   // How can I wait for the dialog to open instead of doing this?
   Thread.Sleep(2000);

   // Sends keys to open dialog and continues execution
}
  • If you're talking about the OS-level open file dialog, you can't access that via Selenium. (Either to know that it's open/closed or to send keys...) – pcalkins Jan 27 '21 at 20:55
  • @pcalkins yes OS level...it's fine I don't need Selenium but would need a better way than just Thread.Sleep –  Jan 27 '21 at 21:53
  • you might be able to detect because javascript should be blocked. Look into "blocking dialog detection"... or "blocking operation"... I believe opening file browse should be blocking. – pcalkins Jan 28 '21 at 18:06
  • Does this answer your question? [Webdriver: File Upload](https://stackoverflow.com/questions/3300580/webdriver-file-upload) – Greg Burghardt Feb 05 '21 at 14:51
  • I figured out that there indeed was an input tag that I can sendkeys to –  Feb 06 '21 at 16:47

0 Answers0