0

I am using the ruby gem selenium-webdriver (2.39.0) to automate testing of a website.

There is a web page with a hidden input tag, which, when a user clicks a different element, is populated with the path from the system file selection dialog.

We had been able to use element.send_keys to remote upload a file for the input dialog. However, this broke on IE recently - we now get an "element not visible" error when using send_keys. After reading about the design goal of selenium 2 to only mirror user interactions I expect this to break for other browsers at some point as well.

Since the selenium 1 execute_script() method does not seem to be available in this gem, I can't modify the input tag to be visible.

I assume others have solved this - how can I perform the file upload?

1 Answer 1

1

The same method exist on that version of selenium-webdriver gem

driver.execute_script("document.getElementById('hidden').value = #{value};")

Here's the documentation:

http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Driver.html#execute_script-instance_method

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

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.