I have an issue. Imagine there are some news items . Some news items opens in a pop-up and others refresh the page to display the news item. Now wat I want is if the news items opens in pop -up then it should close it and if it refreshes the page to display the news item then it should click on the browser back. Is it possible? I have tried a lot of things like using recovery scenario manager but if one works other doesn't and if other works then the first one doesn't. But temporarily I have solved this issue by giving a msgbox wherein if VByes then close the pop -up and if vbNo then do a browser back?
But I guess we need some If condition which will say if the pop up exists then close it else click on browser back.
You could also try the GetROProperty method. It's a bit long-winded but it's worked for me in the past.
Set varHWndList = CreateObject("Scripting.Dictionary")
While (Window("RegExpWndClass:=IEFrame","index:=" & varCounter).Exist And varBool)
varHandle = Window("RegExpWndClass:=IEFrame","index:=" & varCounter).GetROProperty("hWnd")
If (varLastWindow=varHandle) Then
varBool = 0
varCounter = varCounter+1