Reputation: 9
I am trying to print my parent window id, but I am getting output as null. Unable to understand where I made a mistake.
Getting output as null when I try to print it out of the for-loop. Anyone, please help me with this?
Upvotes: -1
Views: 40
Reputation: 53
Change declaration
String parentwin = driver.getWhindowHandle()
in if block to:
parentwin = driver.getWhindowHandle();
Upvotes: 0
Reputation: 11
you have used ,parentwin' as a local variable in first 'if' block. It's scope will be limited to the 'if' block. Hence getting null.
solution- remove declaration of parentwin from if block.
Upvotes: 1