well test.opener.document makes no sense for manipulating something on the popup, cause… the opener is the main window.
Secondly, you’ll have to wait until the popup window is done loading the page you’d told it to open, or the DOM elements you’re trying to manipulate won’t exist yet.
I don’t think you can interact with the window that’s opened the way you’re trying.
… because of the cross-domain script security restriction (also referred as the “Same Origin Policy”). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name.
If you are trying to pre-populate the input, what you could do instead is try appending the query string to the URL in the open. i.e.