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?

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);
0

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

Your Answer

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

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