Ask a Question

Http POST request not working with Sys.OleObject("MSXML2.XMLHTTP") on TestComplete 12.10

SOLVED
GeetaMehta
New Contributor

Http POST request not working with Sys.OleObject("MSXML2.XMLHTTP") on TestComplete 12.10

Hi All,

We have one already developed testcomplete 8 project for windows 7 which has to be run in testcomplete 12.10 version for both windows 7 and 10. When we try to run the solution, we are getting issues with Http Post request while using Sys.OleObject("MSXML2.XMLHTTP").

 

var httpObj = Sys.OleObject("MSXML2.XMLHTTP");

httpObj.open("POST", link, true);

httpObj.send();

 

This httpObj results into error - Member not found into onchangereadystate event and httpObj.readystate is returning 1 always instead of 4. However, the link is working fine - tested into postman tool.

 

Please assist and confirm if the issue is related to testcomplete version compatibility.

Many thanks in advance.

4 REPLIES 4
tristaanogre
Esteemed Contributor

Are you getting the error on the Send?  Or on code after the send?  Which OS are you getting the error on?

Generally speaking, the problem is most likely not with TestComplete compatibility.  What you're executing is not TestComplete exclusive code but simply creating an instance of an existing Windows OleObject and executing methods on that object.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Hey Robert,

Thanks for the prompt response.

 

The OS used for TestComplete 12.10 tool is Windows 10 64 bit. Additionally, the issue occurs after send() method.Please refer below screenshot for the object details post this method.

Please confirm if additional dlls or libraries to be imported into tool for JScript code to make it work.

 

Thanks

GeetaMehta_0-1589116113551.png

Unfortunately, your watchlist screenshot does not help.  As mentioned, this is not a problem with TestComplete or any DLLs or anything that you need to include.  You're instantiating the HTTP object which is a windows object, not a TestComplete object, so you need to go looking at the documentation for that object.

 

A quick google search found this.

 

https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/method-or-data-me...

 

So, the error that you are getting seems to be indicating that somewhere you're attempting to use some member, property, or method that does not actually exist.


Here's what I'd suggestion... remove the object from your watchlist...  It MIGHT be that the reason you're getting the error is that the watchlist is generating it, not your actual code.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sonya_m
SmartBear Alumni (Retired)

Thanks for looking into this tristaanogre!

 

Hi @GeetaMehta! Did this suggestion help?  


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: