This is the full working example. I'm currently using it in my projects.
If you want to change it for sending keys just replace sendMouseClick( obj, pnt ); in Q_FOREACH() with sendKey(obj, key); where you implement key press and release (instead of MouseMove, MouseButtonPress, MouseButtonRelease)
NB! Original post said that there was one single object, while recently I noticed at least 3 different objects in mWebEnPage->view()->children() and that could change in the fututre so instead of discovering which one is needed and hard coding it I prefer to use the loop and just send events to all children.
HTH