Forum Discussion
Hi AlexKaras,
regarding a) and b) you may be right in principle.
But either way, since the FormData object is not supported by TestComplete, the method formData.append() cannot work either. Because even if I try to initiate the FormData object empty ...
var requestBody = new FormData();
... I get the same error.
I did not quite understand what you mean by c). Maybe I should have mentioned that I need the routine for some web tests that have to run on CrossBrowserTesting devices. I wanted to avoid opening another browser tab for such actions in parallel to the tested web application. And of course, I can't access desktop applications on these devices at all - if that's necessary for such additional tools. Otherwise could you please outline the use of Fiddler in this context a little closer?
Thank you and best regards
Hi,
> since the FormData object is not supported by TestComplete
Depending on the scripting language of your test project, you may look for some third-party library/component that will provide such functionality and use it. However, there may be problems with deploying required components to the CrossBrowserTesting environment.
> could you please outline the use of Fiddler in this context a little closer?
The suggestion is based on the assumption that you don't need to send some specific file in your test but it is acceptable if the same file is sent every time.
If this assumption is correct, then you may use Fiddler or any other request-capturing tool to capture the request that sends some small (for performance considerations) file. The captured request will provide you with the already properly encoded body part. So you may store it in some file or as a constant string in test code and use in the test.
- TestKeks7 years agoOccasional Contributor
Hi,
> Depending on the scripting language of your test project, you may look for some third-party library/component that will provide such functionality and use it. However, there may be problems with deploying required components to the CrossBrowserTesting environment.
That's exactly my problem.
Fiddler will then also be excluded as an option.
That's why, in the meantime, I have taken a closer look at the syntax required for the multipart/form-data content type in order to assemble the string for myself, that has to be transmitted.
But therefore I also need an approach to read the byte code of the binary graphic file and append it to my output variable. I assumed that the second code example at https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqbinaryfile/index.html could help me with this:
function ReadByteFromFile() { var Path = "C:\\MyFiles\\Desktop.jpg"; // Opens the specified file for reading var myFile = aqFile.OpenBinaryFile(Path, aqFile.faRead); Log.Message("File by bytes:"); // Reads bytes from the file and posts them to the test log while(! myFile.IsEndOfFile()) { s = myFile.ReadByte(); Log.Message(s); }
// Closes the file
myFile.Close();
}Unfortunately, however, this does not result in the byte code but in a purely numerical chain (I suspect ASCII code?).
But how can I access the unaltered byte code, which I need? I do not find any further details on this in the TestComplete documentation.
Many thanks and best regards
- TestKeks7 years agoOccasional Contributor
3rd attempt (why was my answer to Alex' last post deleted twice?):
Hi,
> Depending on the scripting language of your test project, you may look for some third-party library/component that will provide such functionality and use it. However, there may be problems with deploying required components to the CrossBrowserTesting environment.
That's exactly my problem. :)
Fiddler will then also be excluded as an option.That's why, in the meantime, I have taken a closer look at the syntax required for the multipart/form-data content type in order to assemble the string for myself, that has to be transmitted.
But therefore I also need an approach to read the byte code of the binary graphic file and append it to my output variable. I assumed that the second code example at https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqbinaryfile/index.html could help me with this:
function ReadByteFromFile() { var Path = "C:\\MyFiles\\Desktop.jpg"; // Opens the specified file for reading var myFile = aqFile.OpenBinaryFile(Path, aqFile.faRead); Log.Message("File by bytes:"); // Reads bytes from the file and posts them to the test log while(! myFile.IsEndOfFile()) { s = myFile.ReadByte(); Log.Message(s); } // Closes the file myFile.Close(); }
Unfortunately, however, this does not result in the byte code but in a purely numerical chain (I suspect ASCII code?).
But how can I access the unaltered byte code, which I need? I do not find any further details on this in the TestComplete documentation.
Many thanks and best regards
- AlexKaras7 years agoChampion Level 3
Hi,
Once again in order to double-check:
Do you *really* need to send *different* files from your test? Won't sending of the same file work?
- TestKeks7 years agoOccasional Contributor
Hi Alex,
I apologize for not having explicitly stated that yet. The answer is: Yes, I would like to send a screenshot directly from the respective CrossBrowserTesting machine in certain situations, for example (but not only) in case of an error during testing. And I don't want to have to wait until the log data has finally landed on the local computer after completing all assigned test runs on all the CBT machines concerned (which can take several hours).
Thanks + best regards
Related Content
Recent Discussions
- 28 minutes ago
- 6 hours ago