0

I am using Selenium WebDriver + C# to handle a File upload process. When clicked on a button, the standard Windows File Open dialog box appears.

I use SendKeys to specify the names of the files as

SendKeys.SendWait(filePath);
SendKeys.SendWait(@"{Enter}");

Sometime the file name is not filled in correctly in File Open Dialog box. In that case I would like to read the value entered in the file name. How can I do it in C#? Is there a GetKeys methods like SendKeys

2 Answers 2

1

There is no textbox to enter filepath. The user clicks "Upload files" button. And as soon as this button is clicked, the standard Windows file open dialog appears

Sign up to request clarification or add additional context in comments.

1 Comment

Problem is with the Proces to handle. In this scenario You will need to handle file open dialog oustide the browser.
0

This may depend on the browsers that you use, but usually if you SendKeys(filepath) it should work. What the windows open dialog does is, it simply provides you a more user friendly way to enter filepath. Not that most likely after that it'll display the filepath in the UI element. So instead of SendWait, you can simply try SendKeys with a locator your element.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.