testcafe
testcafe copied to clipboard
Support multiple windows in native automation mode
What is your Scenario?
At present, TestCafe does not support multiple windows in native automation mode.
What are you suggesting?
Support multiple windows in native automation mode.
Thank you for opening this ticket - our team is looking for support of multiple windows in native mode too. Clicking links that open new pop out windows is something we need to cover, so we can't turn this on for every test yet.
same or similar issue:
The application under test is programmed to open a new window or tab when a button is clicked. We need support for this type of interaction in TestCafe, because the application under test cannot always be modified to open in the same window.
The same problem. We have many tests with multiple windows, and native automation mode doesn't work with them.
Are there any workarounds with this @aleks-pro ? Or maybe at least to exclude certain tests from using native automation?
Thanks!
Hi @Jgrabenbauer,
You can create two separate test runs - in Native Automation mode and without it. Specify test paths with the glob pattern as follows: Test files. Use the --disable-native-automation
option for this purpose.
Run tests with NA:
testcafe chrome "tests/**/*" "!tests/multiple-tests/**/*"
Run tests without NA:
testcafe chrome "tests/multiple-tests/**/*" --disable-native-automation
You can do the same with configuration files or with a Runner object. Also, you can filter tests by metadata.
One more request https://stackoverflow.com/questions/76806603/how-to-use-disablenativeautomation-in-testcafe-for-one-test-only
I have to work around particular situations, removing the target attribute with clientFunction and then clicking the element.
ClientFunction((locator) => {
const element = document.querySelector(locator);
element.removeAttribute("target");
});
Also, I had to use the "navigate()" function after getting the link from any attribute or API for those redirections that don't happen with an anchor tag and target attribute.
We have the same issue - there is no workaround, 1 test is part of a larger group where we need to combine native and not native automation modes to avoid this bug Any ETA when this can be fixed/supported? It's a really nasty issue and a blocker for us.
Just to add - the issue happens when click on a link happens, which opens a new target window (tab). The step fails, and the report in json is not even created for us, this is not handled well.
Hi @gforepsly,
We supported the --disable-multiple-windows option in Native Automation mode, and it's already published in TestCafe 3.3.0-rc.1. Please test it.
Is there an option to ignore popup window? I have an auto-closing popup, with proxy mode I just add a small t.wait, but in native mode Testcafe disable popup
Could you elaborate on what you mean by popup window? Do you mean a real browser window or just some kind of DOM element with a fixed/absolute position? Please share a simple reproducible sample to demonstrate what kind of popup you have.
I mean a real window that process authentication on remote system. I don't have access to the real code but it's something like the js below where instead of opening a website yahoo, it's open a auth.html page ... var myWindow = window.open('http://www.yahoo.com','1366002941508','width=600,height=400,left=5,top=3') setTimeout(function() { myWindow.close();}, 3000);
@tandreys
In this case, the only workaround is to use the --disable-native-automation
option to disable the Native Automation mode.
Testcafe released a new version v3.5.0. The experimental CLI flag ‘--experimental-multiple-windows’ allows multiple-window tests with native automation. Please try this solution and let us know if you encounter any issues.
I have a RequestLogger
in my test that expects a certain request to have been logged for the newly opened window. Unfortunately, it seems that all requests from the new window are not recorded with the RequestLogger
, just the ones from the initial window. Is this still unsupported in 3.5.0?
Hello,
Multiple windows mode with native automation is still an experimental feature. Thank you for your feedback. We will take it into account.
I have a similar problem as @mx-bernhard. Any action unrelated the main window, i.e. if you open a new tab or window after clicking a button or resizing the browser window and then perform a validation in a same test, those actions are blocking all suite execution. It's a structural problem because if you have a test that performs any of these actions it completely freezes the execution and does not allow to launch any report. At the moment it's evident in local regression executions and in GitHub Actions executions
Hello @juan-garces @mx-bernhard , Please create a separate ticket based on this template and also share a minimal working example in that ticket so that the TestCafe team can research the issue and help you.
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.