简体   繁体   中英

Detecting files that failed to load while testing with Selenium WebDriver

If you open your dev tools while a page is loading, you'll see all the json/js/fonts/images/etc files that loaded while the page loaded.

I want to be able to detect if any of these failed to load, while executing my Selenium WebDriver tests.

I'm pretty sure WebDriver doesn't support seeing these individual http requests, but what approach should I take to be able to detect any that fail to load? Keep in mind that all my testing is behind a login.

You can create a class containing all the file URLs, do a CURL against it, and compare the return code to see if they return a 200 or whatever.

I don't know which language are you using, but maybe this helps you: https://sites.google.com/a/chromium.org/chromedriver/logging/performance-log

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM