Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurs when a number is passed as an argument to window.open #1908

Closed
Adithya-TS opened this issue Jan 23, 2019 · 17 comments
Closed
Assignees
Labels
AREA: client STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@Adithya-TS
Copy link

What is your Test Scenario?

Like to click a table tag of class button with onclick functionality which have multiple tds.

What is the Current behavior?

The button is getting clicked, test is getting passed but the page is not navigating as expected

What is the Expected behavior?

The button should be getting clicked and it should be navigated to the expected page

What is your web application and your TestCafe test code?

Refer to the attachment below.
Testcode.txt

Your website URL (or attach your complete example):

Please use the file as HTML
Samplecode.txt

sampleimage

Screenshots:

sampleoutput


Steps to Reproduce:

  1. Go to my website ... Refer to the attachment samplecode.txt (HTML Page)
  2. Execute this command... testcafe ie testcode.js -e
  3. See the error... Refer to the screenshot "sampleoutput.jpeg"

This is not the complete application we use, have sent you the sample script to reproduce the error, when running the script in the original webpage, we get the below error as mentioned in the attachment.
console1

Also tried with client function for the browser IE, error occured as mentioned in below screenshot

console2

Your Environment details:

Testcafe version: 0.21.1
NodeJS version: 8.11.2
command-line arguments: testcafe ie testcode.js -e
browser name and version: IE and 11.0
platform and version: Windows and 10.0.0

@Adithya-TS
Copy link
Author

Please also refer to this link for similar issue https://testcafe-discuss.devexpress.com/t/urgent-unable-to-click-link-inside-table/1020

@AlexKamaev
Copy link
Contributor

I've researched your page and found that the second argument of this function:

popwin = window.open('../control?navigate=login', IDNumber, config='left=0,top=0,width=' + (screen.availWidth-20) + ' height = ' + (screen.availHeight-50) + ' toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, directories=no, status=yes').focus();

IDNumber has the Number type. However, according to the article , the window.open function should accept a string value as a second argument.

 I rewrote the argument to IDNumber.toString() and it worked. Please try this approach.

In addition, I wish to mention that currently TestCafe does not support testing in multiple browser windows. Please refer to the following issue to track the progress with this feature DevExpress/testcafe#912

@Adithya-TS
Copy link
Author

Alex, thanks for the help but this is an application of Midas fusion, off the shelf application so we cannot ask them to change the IDNumber type or modify the page so is there any other solution for this issue without modifying anything in the page.

Please note, It is working fine manually when I click on the start button as well as it is working fine in Selenium but since we are using Testccafe as our baseline, request you to help with this issue. Thanks in advance.

@AlexKamaev
Copy link
Contributor

Thank you for your clarification. We will fix this behavior, so the error won't appear.
Please keep in mind that the use of window.open with TestCafe will not open a new window, but rather open a new page in the current window.

@AlexKamaev AlexKamaev reopened this Jan 24, 2019
@Adithya-TS
Copy link
Author

Thanks, Alex, TestCafe will not open a new window, but rather open a new page in the current window, this is fine as it is known already. Can you let me know when this issue will be fixed? Thanks in advance

@AndreyBelym AndreyBelym transferred this issue from DevExpress/testcafe Jan 25, 2019
@LavrovArtem LavrovArtem self-assigned this Jan 25, 2019
@LavrovArtem LavrovArtem added this to the Planned milestone Jan 25, 2019
@AlexKamaev
Copy link
Contributor

I cannot give you accurate estimate, but I think we'll fix it in one of nearest releases of the testcafe-hammerhead module, since this issue is related to it.
Track the status of this issue to be notified when we fix it.

@Adithya-TS
Copy link
Author

Thanks, Alex

@Adithya-TS
Copy link
Author

I've researched your page and found that the second argument of this function:

popwin = window.open('../control?navigate=login', IDNumber, config='left=0,top=0,width=' + (screen.availWidth-20) + ' height = ' + (screen.availHeight-50) + ' toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, directories=no, status=yes').focus();

IDNumber has the Number type. However, according to the article , the window.open function should accept a string value as a second argument.

 I rewrote the argument to IDNumber.toString() and it worked. Please try this approach.

In addition, I wish to mention that currently TestCafe does not support testing in multiple browser windows. Please refer to the following issue to track the progress with this feature DevExpress/testcafe#912

Hi Alex,
I tried changing the type of IdNumber by injecting this argument IDNumber.toString() using client function as it is not possible to change the source code, even if it is changed using client function it is showing the same error as before. Can you please help with this?

@LavrovArtem LavrovArtem modified the milestones: Planned, Sprint #27 Feb 8, 2019
@AlexKamaev
Copy link
Contributor

I think there is no appropriate workaround for the issue, however we are planning to fix it in the current sprint.

LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Feb 11, 2019
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Feb 11, 2019
@hiruthre
Copy link

@AlexKamaev Currently there is a folder name 'testcafe-hammerhead' in node_modules when we downloaded testcafe. So above fixed 'testcafe-hammerhead' and folder in node_modules are same... if not then, how to use this updated 'testcafe-hammerhead'...

Thanks in advance...

@AlexKamaev
Copy link
Contributor

@hiruthre
The testcafe-hammerhead module is core module of TestCafe. The current testcafe-hammerhead version in npm is 14.4.13. The fix will be available only in the next version, which is not published yet. After the new version of testcafe-hammerhead is published, you can manually update the package.json file in your TestCafe repository and run npm install command.
Or, you can just wait for new TestCafe version, which will probably contain the updated testcafe-hammerhead version with the fix.

@hiruthre
Copy link

@alex Thanks for the update.. can you let me know when the new release (testcafe-hammerhead or testcafe) will be available..

@AndreyBelym AndreyBelym changed the title Tag inside a Table with on-click function is not working properly in IE Browser An error occurs when a number is passed as an argument to window.open Feb 14, 2019
@AlexKamaev
Copy link
Contributor

@hiruthre
We've published the new testcafe-hammerhead 14.4.14 version. Please update your package.json. We're are also going to update the testcafe version soon.

@Adithya-TS
Copy link
Author

Hi Alex, Thanks for your support and help, For updating the latest testcafe-hammerhead 14.4.14 version, I need to update my package.json and rum npm i testcafe-hammerhead. Is this correct?

Also can you please notify here, once the testcafe version has been upgraded. Thanks in advance

@AlexKamaev
Copy link
Contributor

@hiruthre
After your package.json is modified, it's sufficient to run the npm i command. It will update testcafe-hammerhead automatically.
The new TestCafe version has already been published. You can use it right now. So there is no need to update testcafe-hammerhead separately.

@hiruthre
Copy link

Thanks for the update Alex...

AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

4 participants