Unable to get control over new tab

Hello,

I am trying to get xpath of an element in new tab,
but i can’t get control over new tab,

the control is in previous tab.

Thanks in advance.

Hi Shanda.

Have you tried using CTRL + SHIFT + TAB to alternate between tabs before executing the xpath?

Hope it helps :slight_smile:

1 Like

I have tried it, but it doesn’t work.

when i try to get value from xpath of the new tab, it displays an erroer that no web element present.

and when i try to get value of xpath for previous tab staying on new tab, i can get the value.

which means, new tab opens but i can’t get its control of its elements.
the control is still in previous tab.

You can switch to a new tab using a custom action.
It switches to the window next to the one the focus is currently on.

@CustomScriptAction(
)

def customScript() {
   switchToNextWindow()
}
1 Like

Thankyou

it worked

1 Like

how to get back control to previous window?

Use this script

@CustomScriptAction(
)

def customScript() {
   switchToPrevWindow()
}
1 Like

Thank you.

It Worked

1 Like