Search code examples
pythonseleniumpaintpageload

First paint time in Python (may be using Selenium or without it)?


I want to find the time whatever (an object, image, text, link, DB or anything) loads first in a requested website using Python and Selenium.


Solution

  • Checkout performance.timing, it's JavaScript and comes default in your browser. You have a lot of options to display, like:

    • navigationStart
    • connectStart
    • connectEnd
    • domLoading
    • domInteractive
    • domComplete

    Just go to your console window in your browser and type performance.timing. Might be of use to you.

    If you find something you can use, you can use selenium to execute the JavaScript inside the browser using execute_script:

    driver.execute_script(‘return performance.timing.domComplete’)