I am trying to select a newly-opened window using Selenium, and the select_window() method requires its WindowID.
I have tried using the window’s title, as other places have suggested, and turned on Selenium’s debug mode, as the documentation suggests to see a window.open intercept, but neither option seems to have worked.
Is there just some simple javascript command I can enter in the new window’s console to view the window ID?
So there are two things, as I am not sure what is your exact scenario.
So considering you have opened the new window, while doing so, you can define the window id.
So for example:-
Or if the new window is popup(not explicitly opened by you), you could simply use