Switch to Window command failed to execute

For my test I need to click on one button that will open another tab/window and then work on that new opened page.
I have tried all of the commands like: Switch to Window Index/Title/Url. And none of theme work for me. Test case stopped at this action.
Can you help me or maybe you need some addition description?

Image 1.jpg

It seems strange to me that the Window switching commands don’t have a timeout parameter while the Frame switching commands do. A timeout, of course, implies the command will make multiple attempts to switch over a specified period – perfect for things that don’t happen “instantly”, like opening new windows/tabs.

So try adding a delay before switching to the new window.

Russ Thomas said:

It seems strange to me that the Window switching commands don’t have a timeout parameter while the Frame switching commands do. A timeout, of course, implies the command will make multiple attempts to switch over a specified period – perfect for things that don’t happen “instantly”, like opening new windows/tabs.

So try adding a delay before switching to the new window.

I added delay 5 and 30 sec. It didn’t help.
Here you can look at part of the script:

WebUI.openBrowser(’’)

WebUI.maximizeWindow()

WebUI.navigateToUrl(‘https://www.signatours.dk/’)

WebUI.click(findTestObject(‘Page_Rejser med Signatours Vlg mel (5)/div_Ok’))

WebUI.click(findTestObject(‘Page_Rejser med Signatours Vlg mel (5)/div_Vlg rejseml’))

WebUI.click(findTestObject(‘Page_Rejser med Signatours Vlg mel (5)/span_Emiraterne’))

WebUI.click(findTestObject(‘Page_Rejser med Signatours Vlg mel (5)/span_Dubai’))

WebUI.click(findTestObject(‘Page_Rejser med Signatours Vlg mel (5)/span_Sg’))

WebUI.click(findTestObject(‘Page_Rejser til Dubai SignaTours.d (2)/strong_Ls mere’))

WebUI.delay(30)

WebUI.switchToWindowTitle(‘Amwaj Rotana Jumeirah Beach’)

WebUI.click(findTestObject(‘Page_Amwaj Rotana Jumeirah Beach i/strong_Sg pris’))

WebUI.click(findTestObject(‘Page_Amwaj Rotana Jumeirah Beach i/strong_Bestil’))

WebUI.closeBrowser()

Test always breaks at switchToWindow step. I tried id “1” and url “https://www.signatours.dk/emiraterne/dubai/amwaj-rotana-jumeirah-beach?airport=hotelonly”, also.

WebUI.switchToWindowTitle('Amwaj Rotana Jumeirah Beach')

That’s not the complete window title:

<title>Amwaj Rotana Jumeirah Beach i Dubai | Book online nu!</title>
1 Like

Russ Thomas said:

WebUI.switchToWindowTitle('Amwaj Rotana Jumeirah Beach')

That’s not the complete window title:

<title>Amwaj Rotana Jumeirah Beach i Dubai | Book online nu!</title>

You are right. But even if I use full title - next action is not working. So, after ‘switchToWindow’ step - test breaks.

Looks like active window for me and active window for studio are different.

Yes, were you able to find a solution?

@Oleh_Yevchuk Were you able to find the solution? Even I am not able to switch to window using title. Please let me know how you resolved this issue.