0

Writing tests with c#/nunit and running tests on the same machine I could use System.Windows.Forms, or call Autoit script to handle upload window that selenium can't interact with normally.

But this does not work if I run tests remotely.

Is there any option or trick to upload file using windows file upload dialog when executing tests remotely?

Gryu
1811 silver badge14 bronze badges
asked Jul 14, 2016 at 15:25

2 Answers 2

1

Maybe this will help someone

In my case, there was file upload form, thats hidden. So after making it visible (in this case, change class), its possible to use SendKeys and send file path to that element, thus uploading file (if it exists in that VM)

Example:

 string filePath = "C://File//Path/File.txt";
 IJavaScriptExecutor js = driver as IJavaScriptExecutor;
 js.ExecuteScript("document.getElementById('import-file-btn').className = 'btn'");
 Find(import-file-btn).SendKeys(filePath);
answered Nov 2, 2016 at 10:35
0

No, there is not any option or trick to upload a file using the windows file upload dialog when executing tests remotely.

answered Jul 14, 2016 at 16:38

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.