testcafe
testcafe copied to clipboard
Add function to switch to relative tab
What is your Scenario?
I'm having this issue, and am stuck, because it's a combination of several challenges that together make it next to impossible to solve my use case.
I've identified one missing feature which would solve my problems:
In the spirit of this
https://testcafe.io/documentation/402841/guides/intermediate-guides/multiple-browser-windows
and this
https://testcafe.io/documentation/402639/reference/command-line-interface#--experimental-multiple-windows
I would like a function to switch to a "relative" tab, i.e. the next or previous tab. For example, in Chrome you can use ctrl + tab and ctrl + shift + tab to switch to the next or previous tab. You can also use ctrl + [1-9] to jump to specific tabs.
What are you suggesting?
Extend the .switchToWindow() API or add another API to be able to switch to relative (next or previous) tabs.
What alternatives have you considered?
disableNativeAutomation and disableMultipleWindows and experimentalMultipleWindows
Additional context
No response
Thank you for sharing this information.
Have you tried the **switchToPreviousWindow **method, which activates the previously active window?
If not, please try it and let us know your results.
https://testcafe.io/documentation/402678/reference/test-api/testcontroller/switchtopreviouswindow
Hi @Bayheck yes and .switchToPreviousWindow() doesn't work because 1. either I don't have multiple tabs/windows open or 2. I have multiple tabs open but I have not yet switched to the 2nd tab. It is finding out how to switch to the 2nd tab without knowing it's dynamic url that is one of the challenges I'm facing.
Hello, could you try using getCurrentWindow together with switchToWindow?
Also, could you please create a minimal working example
@Bayheck I've tried using .getCurrentWindow() and .switchToWindow() but it doesn't help.
I'd need something more like e.g. .switchToNextWindow() or .switchToWindowNr(nr), where, I can switch to a relative window/tab of which I don't know the url of in advance.
Unfortunately I can't really provide an example because I don't know the code behind it or how it's made, I am merely testing it
Unfortunately, without a reproducible minimal example of the issue, we cannot determine its cause.
In addition, please clarify how your new window is opened. Is it opening, and TestCafe does not switch to that window?
Please also elaborate on the following:
I've tried using .getCurrentWindow() and .switchToWindow() but it doesn't help.
How exactly did you use these methods, and what issues did you encounter?
This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.