I'm getting a timeout error when waiting for table element to appear containing results of a query executed in the previous steps of a cucumber test scenario. The strange thing about this error is that it only happens the first time the test is run (within the debian Linux command shell) but then the will succeed (ie the wait_until_present call does NOT timeout) for each subsequent test run after that. If I do not re-run the test for 30 minutes and then try to run it again within the same command shell the issue is reproduced but then each run after that will succeed. See below cucumber test script results as below
Below is the code that runs the And I click on the Query button step
def click_query_button
@browser.button(:text => "Query").click
@browser.div(:class => "xtb-text").wait_until_present
begin
@browser.table(:class => "x-grid3-row-table").wait_until_present
rescue
@browser.screenshot.save 'query_button_result_table_fail.png'
puts "Results table exists?"
puts @browser.table(:class => "x-grid3-row-table").exists?
puts "WARNING: waited 30 seconds without the results table being loaded, taking a screenshot and re-running the scenario as it should appear on the second attempt"
puts "Refer to MAP-841 for further details"
end
I tried increasing the wait time out to 60 seconds which did not make a difference. Also tried adding the @browser.table(:class => "x-grid3-row-table").exists?
call and it was apparent that the table element did not exist in the DOM and was not going to load regardless of how long I set the timeout. I also tried re-running the @browser.button(:text => "Query").click
step a second time within the same test scenario and it did not make a difference.
I also tried reproducing the error manually on the application under test using a windows 7 machine and running a Chrome browser v59.0.3071.86 (simulating what users actually have) but could not reproduce it.
My environment is
- Debian Linux v7.1
- ruby 2.0.0p643 (2015-02-25 revision 49749)
- watir v2.4.8
- watir-webdriver (0.9.1)
- selenium-webdriver (2.48.1)
- Chrome Browser v45.0.2454.85
- Using xvfb to render the above browser in a headless linux environment
- ChromeDriver 2.20.353124
Would greatly appreciate any ideas for further diagnosis that I could apply.