DEV: avoids using document.write (PR #13858)

It doesn’t provide much than just avoiding some logs in tests. I didn’t change test_starter as it’s going to be removed at some point.

GitHub