Ask a Question

Read entries in browser console

SOLVED
geneticmaterial
Contributor

Read entries in browser console

Hopefully, a simple question.

If the developer has implemented something that logs to the browser console.

Is there a way that testComplete can get hold of the logged message?

1 ACCEPTED SOLUTION

Accepted Solutions
geneticmaterial
Contributor

Re: Read entries in browser console

I am no longer exploring this as an option 9writing and reading from logs.

 

Smartbear have come back to me offering a solution but it's a difficult one to implement, also we (dev and I) have chosen not to use the console to retrieve data.

 

the solution provided by smartbear should anyone need it is:

Regarding getting values from the browser console via TestComplete: I would recommend you try using the MSAA feature. To use the MSAA feature, please follow these steps:
 
1. Open your project in TestComplete.
 
2. Choose Tools -> Current Project Properties, then go to Open Applications -> MSAA.
 
3. Once there, check the "*" property checkbox.
 
4. Save the project and refresh the object browser.
 
After that, it becomes possible to get the values of the browser console fields. Please watch this video [https://s3.amazonaws.com/webtocasefiles/2021/1cc03977-14ec-e4e8-17bf-d95a1ef2b2b3/2021_07_01-21_34_4...&] to check how the values from the Chrome browser console are recognized in TestComplete (with the MSAA feature turned on).

View solution in original post

9 REPLIES 9
Marsha_R
Community Hero

Re: Read entries in browser console

I would try using object spy on the console and/or recording a test that includes checking the console for the message you are looking for and see what TestComplete gives you.  

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
geneticmaterial
Contributor

Re: Read entries in browser console

Thanks for the reply. 

I am unable to find the console of the browser using object spy.

Also, I am trying to piggy back on already written keyword tests so getting these test re-written to start opening the dev tools is not an option. There will be dozens of items I need to capture per test too I'm afraid.

Marsha_R
Community Hero

Re: Read entries in browser console

One does wonder if there is a solution, how you are going to use it without rewriting the tests, at least to call a function some how?   

 

In any case, I would ask Support this question directly.  Here's the link:

https://support.smartbear.com/testcomplete/message

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
geneticmaterial
Contributor

Re: Read entries in browser console

Our dot net developers are introducing some new functionality to capture data to send to adobe (like goole tag manager), my automated tests are to capture this information.
They are prepared to push each event log out to the console for me to grab as I am struggling to get hold of the updated objects in the browser memory (like when you search in console manually for objects etc)

Marsha_R
Community Hero

Re: Read entries in browser console

If it's just a log, why not deliver it to you in a file?  That would likely be easier to handle in TestComplete.

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
geneticmaterial
Contributor

Re: Read entries in browser console

Yes, this is something I'm going to explore

geneticmaterial
Contributor

Re: Read entries in browser console

I am no longer exploring this as an option 9writing and reading from logs.

 

Smartbear have come back to me offering a solution but it's a difficult one to implement, also we (dev and I) have chosen not to use the console to retrieve data.

 

the solution provided by smartbear should anyone need it is:

Regarding getting values from the browser console via TestComplete: I would recommend you try using the MSAA feature. To use the MSAA feature, please follow these steps:
 
1. Open your project in TestComplete.
 
2. Choose Tools -> Current Project Properties, then go to Open Applications -> MSAA.
 
3. Once there, check the "*" property checkbox.
 
4. Save the project and refresh the object browser.
 
After that, it becomes possible to get the values of the browser console fields. Please watch this video [https://s3.amazonaws.com/webtocasefiles/2021/1cc03977-14ec-e4e8-17bf-d95a1ef2b2b3/2021_07_01-21_34_4...&] to check how the values from the Chrome browser console are recognized in TestComplete (with the MSAA feature turned on).

View solution in original post

AlexKaras
Community Hero

Re: Read entries in browser console

Hi,

 

Thank you for sharing the suggestion from Support.

Another idea that I got is to ask your developer to add some hidden field to the page and post log messages to this field. You should be able to access this field from TestComplete and analyze its contents. The major problem that I see here is to not forget to remove this field in production.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
geneticmaterial
Contributor

Re: Read entries in browser console

Hi, no worries. Good to share as there isn't online really!

 

This data is actually held in a JSON variable in a script in the HTML

We were having trouble getting the item that is actually held in browser memory (after it had been transformed by numerous of the dev's javascripts).

We did finally get a solution to this and found it being held on the browser window so all is good there.

 

I also need to capture the details of event listener triggers, so we are taking the same approach and built another array to hold these events  which I get hold of in the same way (although we are having issues getting object members from this array; the objects are all undefined...so any help here would be nice 😉 )

cancel
Showing results for 
Search instead for 
Did you mean: