It looks like this is an issue with the speed test api/script if anything. From what I can tell the 'SomApi.startTest()' line is being called too soon, even though it's not triggering an error. The stuff you see appear in your console shows up after the speed test api has fully initialized. This seems to take a short amount of time, even after the window has loaded (the window onload event triggers once all of the resources for a page have been loaded, but scripts can still be busy executing stuff).
I found that setting a slight delay on the speed test function was the only way to solve it:
(function(){ setTimeout(btnStartClick, 1500); })();
But again I think this should be looked at from the speed test api standpoint first. There may very well be an event trigger that fires once the speed test object has fully been initialized. You'll have to check their documentation but if it exist then you would be better off using that to fire the btnStartClick() function instead of using the windows load event.