this will fail for drivers which don't support javascript, and so cannot wait until a JS expression becomes true