Stop page load, or visit page without waiting for full page load -Capybara



  • Background: A web page takes about 2+ minutes to load. Problem: I am currently automating acceptance test using Capybara, Rspec, Selenium. Visit(URL) -- waits for all the way until the page is loaded or times out.

    I extended the timeout but it causing increased the execution time of the test.

    Is there any way I can visit URL without having to wait for the full page to load. I do not need the whole page to load. All I care about is to validate if the user is logged in or not by expecting user first name + last name on the header of the page.



  • What visit waits until is determined by the specific driver used (chromedriver, geckodriver, etc) and the page load strategy that driver is configured to use - https://w3c.github.io/webdriver/#navigation. Unfortunately, if you're using Chrome the "interactive" page load strategy won't be supported until Chrome/chromedriver 77 but you could configure a driver with the "none" strategy for use in the few tests where you need it.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2