问题描述:

Hi is there any way to ignore the page load when running selenium cucumber, because it always fail my test and i just want to check if that content is present or not.

please don't say add sleep.

the issue im having is that the content is present but its always waiting the page to be fully loaded and sometimes it got stock trying to get some api call to a 3rd party company.

网友答案:

Here are some approaches you could try

  1. Change your driver and us webkit. Setup webkit to not load external links. See http://robots.thoughtbot.com/speed-up-javascript-capybara-specs-by-blacklisting-urls

  2. Ensure you understand and us the has_no methods if you are testing that something is not present e.g. use

    expect(page).to have_no_css '.test' # fast
    

    rather than

    expect(page).to !have_css('.test') # slow will always wait until timeout
    
  3. Change the default timeout to something shorter (perhaps only for this scenario, using a tag)

相关阅读:
Top