Unable verify elements when switch to another window using spy web

Hi There.
I can spy web on initial web page. In my test , I click on the button on the initial page which switch to another window. Now I want to use spy web on second window. I can capture the object on second page but when I try to verify and highlight, it forced me to move on first page. I can’t verify my xpath for the object captured on second window. Pls suggest me how can I check my xpath is correct on second window.

I don’t use the Spy tool personally. I don’t know it well. To me the Spy is a tool to create new Test Objects with locators automatically generated based on HTML elements of the target web page.

I don’t know if the Spy is well-designed for verifying the Test Objects that are already there. Possibly not. If you find the Spy does not do what you want it to, then you should not stick to the Spy tool. Find alternatives.

You can create some Test Cases with which you verify Test Objects generated by the Spy. A new Test Case will open a browser with the URL of the 2nd page, or start with the 1st page and then navigate to the 2nd page. The Test Case will call WebUI.verifyElementPresent(TestObject to), and close the browser. If the Test Object is defined with correct locator (xpath), it will pass. If the xpath is wrong, it will fail.