Hello,
There is a button on our website that opens a PDF in a new window. In my test case, I have set it up so that the URL for the original window is captured and saved as a variable then the PDF button is clicked/opened. My next step is “Switch to Window URL” with the saved URL variable as the input. However, what actually happens is a rapid switch back and forth between the tab I need to continue the test on and the PDF tab.
The script is below:
WebUI.getUrl()
‘Click Materials’
WebUI.click(findTestObject(‘Clinian Queue/Materials Button’))
‘Focus on the Materials Modal’
WebUI.focus(findTestObject(‘Clinian Queue/Materials Modal’), FailureHandling.STOP_ON_FAILURE)
‘Click Treatment Plan PDF’
WebUI.click(findTestObject(‘Clinian Queue/Treatment Plan PDF’))
‘Delay for PDF loading’
WebUI.waitForPageLoad(2)
‘Switch to original tab’
WebUI.switchToWindowUrl(url)
Let me know what should be changed to make this work.
Thank you,
Lauren
2 Likes
I am having the exact same issue.
Switch the tab using index, which starts from “0”. Use the following line in order to access second tab:
`WebUI.switchToWindowIndex(1)
Follow below link for more details.
https://docs.katalon.com/display/KD/[WebUI]+Switch+To+Window+Index `
1 Like
Hi Lauren -
If you are still having this issue, you could try the Switch to Window Index Method
WebUI.switchToWindowIndex(1)
Also, try adding some wait statements.
Regards
I have the same exact issue, window just switches back and forth rapidly.
Tried WebUI.switchToWindowIndex(1) and also SwitchToWindowTitle…nothing works.
Anyone resolved this issue?
Try like this:
#Switch to original
WebUI.switchToWindowIndex(0)
WebUI.delay(2)
#And then switch to the second one.
WebUI.switchToWindowIndex(1)
WebUI.delay(2)
With this, I can download from google drive where the download file is higher and google drive cannot scan and I was redirected to another page.