SwichToLastWindow / NextWindow is not working

Last week this custom script with this code was working:

@CustomScriptAction(
)
 
def customScript() {
  driver().switchToLastWindow()
}

Now, it’s not, and I cannot find a way to handle web elements in the new tab I’m opening, any help?

Thanks

Hi @rmora

Please try this solution

Seems like I had to place the custom script in another step before it originally was, this solved it, thanks

Thanks for the update @rmora

Glad the issue is solved;)