cancel
Showing results for 
Search instead for 
Did you mean: 

Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

SOLVED
twhitehouse
Contributor

Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

My script will successfully sign into Gmail, click on an email, and click on the link in that email if and only if I do not sign out of Gmail or close the browser.  As soon as the user is no longer signed into Gmail, even though my automation script can successfully sign the same user into Gmail, the mapping is no longer correct for what Gmail has at that point.  Gmail ( and even mail.com for that fact ) changes the links dynamically upon page load.  I can not stay signed into Gmail the whole time. 

 

Also, when I signed out of Gmail and signed back in, Test Complete wanted me to check out the Name Mapping again to create new links when I tried another property check point.  Test Complete made a new mapping that was not the same as the one that worked before I signed out of Gmail.  So, I am very certain that Gmail is changing things on me when I sign back in as the same user.

 

So, in my automation script, how can I still sign out of Gmail, sign back into Gmail and click the link in the email if the site dynamically changes objects each time I sign into Gmail?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Colin_McCrae
Community Hero

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

I did get gmail through a browser working after restarts and suchlike.

 

But I do remember the map was a horror story. I'm sure it was about 30 levels deep to actually get to the body of an e-mail. I'm pretty sure I had to go all the way through the map, VERY carefully, and find a couple of identification properties that seemed to indicate session ID's and wildcard them.

 

This was quite a few versions of Chrome ago, so my map may not still work. Also, that script and the VM which ran it is all zipped away and archived so I can't easily check it for you I'm afraid. (I'm actually on holiday today ... I just remoted into my work machine to check something on e-mail there ...)

 

But plough through the object map. Looks for long random strings in properties. They tend to be session related and/or generated on the fly.

 

It may also be worth enabling "find on any level". Or using a top level container and find (or series of finds), rather than a name map.

View solution in original post

HKosova
Moderator

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

This is not an answer to your question, but rather a suggestion. If you aren't actually testing the Gmail interface, consider accessing Gmail and email contents programmatically. There're third-party email client libraries, such as .NET MailKit, that you can use via CLR Bridge/dotNET. Imho this would be easier than dealing with the UI map.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

10 REPLIES 10
Colin_McCrae
Community Hero

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

I did get gmail through a browser working after restarts and suchlike.

 

But I do remember the map was a horror story. I'm sure it was about 30 levels deep to actually get to the body of an e-mail. I'm pretty sure I had to go all the way through the map, VERY carefully, and find a couple of identification properties that seemed to indicate session ID's and wildcard them.

 

This was quite a few versions of Chrome ago, so my map may not still work. Also, that script and the VM which ran it is all zipped away and archived so I can't easily check it for you I'm afraid. (I'm actually on holiday today ... I just remoted into my work machine to check something on e-mail there ...)

 

But plough through the object map. Looks for long random strings in properties. They tend to be session related and/or generated on the fly.

 

It may also be worth enabling "find on any level". Or using a top level container and find (or series of finds), rather than a name map.

View solution in original post

twhitehouse
Contributor

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

Oh boy!  Looks like I have quite a chore ahead of me.  I will do the suggestions you listed.  Thanks for the reply and wish me luck!

twhitehouse
Contributor

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

Taking the advice from Colin_McCrae, I had to manually update the Name Mapping file.  So, here is how I fixed this:

 

1. I did a Check Property to get the path for the I wanted mapped into the Name Mapping file.

2. I pasted the path into my script and added a ".click" because I wanted to click on the item on the web page ( we will come back to that in a few steps )
3. I went into the Name Mapping and found the item mapped

4. I moved it up in the Name Mapping a few levels so that it was under one of the top levels in the mapping.  Basically, for me, this meant bypassing a lot of panels like panelabc, paneldaad, panelwieui, etc.

5. Once I had the item I wanted mapped above all of those panels, I deleted those panels from Name Mapping

6. Then, I went back into my script and edited what I pasted with the ".click" on the end from step 1.  I had to remove the ".panelabc", ".paneldaad", and ".panelwieui", etc...  Once I removed all of the extra items in the path in my script, my script clicked on the link from the ".click" I had at the end.

 

I did not want to write a book, so I left some details out.  The summary is to edit the Name Mapping and move the items up underneath an item that is not changing on the dynamically loaded web page.  Make sure to match that in your script though also.

Colin_McCrae
Community Hero

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

All sounds familiar and about right. Well done! 🙂

twhitehouse
Contributor

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

Well, I guess not so fast...lol

 

I was able to get this to work successfully, sometimes.  But, other times, it still will not find the item on the page.  I put delays and break points and I am not sure timing is the issue.

Is there another way I can do this?  Can I use Selenium IDE or web driver along with Test Complete?  Switching from our web site to Gmail and back I think is also causing issues.

 

I guess I am scratching my head because I can not pin down the problem.  Why was I able to do this successfully 1 time the whole way through but other times I was not able to?

HKosova
Moderator

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

This is not an answer to your question, but rather a suggestion. If you aren't actually testing the Gmail interface, consider accessing Gmail and email contents programmatically. There're third-party email client libraries, such as .NET MailKit, that you can use via CLR Bridge/dotNET. Imho this would be easier than dealing with the UI map.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

twhitehouse
Contributor

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

Yes, this was an option I was pondering as well.  I will look into your suggestion.  I am not directly testing the GMail interface.  I just need to get to a link that is inside of an email.  I actually originally started with mail.com.  The mail client does not matter.  I just need to send the email somewhere, open it, find the link and click on it to direct back to our web site.  So, I agree with you at this point after 2 mail clients have posed similar obstacles that we need to find another solution.


Thanks!

Colin_McCrae
Community Hero

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

I've just resurrected the project I was accessing Gmail with.

 

I think I would go with the programmatic solution as well. They have totally changed the way everything works since I wrote my script. Two sign-in pages - user ID on the first, password on the second. It only used to be one. Then, once I signed in manually, and checked the mapped objects, everything on the inbox page has changed. Google change things frequently.

 

If I was to rewrite it now, I'd probably go for programmatric access for long term reliability.

HKosova
Moderator

Re: Sign into gmail after dynamic reload of everything previously mapped in Name Mapping

Note: If you use 2-step verification for Google account, Gmail doesn't allow programmatic login with the account password. You need to generate an application-specific password for TestComplete here:
https://security.google.com/settings/security/apppasswords


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors