1

When uploading files to a website you will usually press an upload button which opens up the file browser of the OS you are using. I have a series of automated Selenium tests that runs remotely. Because I'm running the tests remotely I need to do everything through Selenium. One of the ways I'm able to interact with the browser in Selenium is by executing javascripts. Is it possible to create a javascript that will write in the path of the file and then hit enter (or click on OK)? Or is javascript only able to interact with objects in the browser?

2 Answers 2

1

No. You cannot do it. And the reason is security.

If such script would exists, a malicious site could easily upload files from your PC to their server!

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

2 Comments

I assume this means I cannot use javascript to launch a local program/script that will perform the keyboard actions either?
No. You cannot do that as well.
1

No, this is not possible because of security reasons.

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.