My application checks for geolocation permission immediately when the page loads. I use a ClientFunction to stub the geolocation API to respond as if the user has granted the permission because TestCafe doesn't provide a way to intercept the permission dialog. The problem is that ClientFunctions execute after the page code has executed. I need to set up my stub before the page loads. Is there anyway to do this?