Take the 2-minute tour ×

I am trying to upload a file to our console which works fine, but the same code for a bigger file throws a timeout error. When I upload a file, I assert for the progress bar to be present which indicated the file is still being uploaded.

Below is the code, to upload a file:

Then (/^I upload with id "(.*?)" file present in the location "(.*?)"$/) do |id_name,filepath|
  id_name = config[id_name]
  filepath.split(',').each do |filepath|
  @browser.file_field(:id => id_name).set(filepath)
  @browser.div(:id =>"progressBar").wait_while_present

I get the error Net::RunTimeout when the file is being uploaded. I am trying to wait till the file is uploaded to execute my next command, but somehow I am getting a timeout error.

I am attaching the html tag:

<div id="progressBar" class="no_margin ui-progressbar ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="33"></div>
share|improve this question

2 Answers 2

By default, the line:


Will only wait 60 seconds. I am guessing that your problem is here - ie this is taking more than 60 seconds.

The Element#wait_while_present method can take an optional parameter to specify how long to wait in seconds. You could try putting in a larger timeout, for example, 3 minutes:

@browser.div(:id =>"progressBar").wait_while_present(180)
share|improve this answer
I tried using wait_while_present(seconds), but i still get Net::ReadTimeout error. –  user3486694 Apr 8 at 19:56
It would help if you update the question to give the full exception you are seeing and which line it is occurring on. –  Justin Ko Apr 8 at 20:47
I have edited my question. I just see the error which i have mentioned, also i have added the html tags. –  user3486694 Apr 8 at 21:35

Scenario 1:

You can try uploading that particular file manually and see if your given timeout second is enough at:


Scenario 2:

Observe running your script, and observe what happened while file being uploaded, is file uploads properly in your given seconds and upload progress bar vanishes? If that try changing your element location other than div(:id =>"progressBar") at:

@browser.div(:id =>"progressBar").wait_while_present(seconds)
share|improve this answer

Your Answer


