Oleh Yevchuk
Katalon Apprentice
04/16/2018
edited April 16

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?
Upvote
Quote

Comments

  • Russ Thomas
    Katalon Expert
    04/16/2018

    WebUI.switchToWindowTitle('Amwaj Rotana Jumeirah Beach')
    That's not the complete window title:
    <title>Amwaj Rotana Jumeirah Beach i Dubai | Book online nu!</title>





    Best Answer
    Upvote
    Quote
  • Russ Thomas
    Katalon Expert
    04/16/2018
    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.
    Upvote
    Quote
  • Oleh Yevchuk
    Katalon Apprentice
    04/16/2018
    edited April 16
    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.
    Upvote
    Quote
  • Oleh Yevchuk
    Katalon Apprentice
    04/18/2018

    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.
    Upvote
    Quote
  • Oleh Yevchuk
    Katalon Apprentice
    04/18/2018
    Looks like active window for me and active window for studio are different.
    Upvote
    Quote
Sign In or Register to comment.