Geeks With Blogs
Maryanne's Blog Another Geek with A Blog

Ok so I've hit an ANNOYING snag in my automation travels at my New Co.  which is starting to drive me NUTS.

Apparently, on one of their Web Apps, the client couldn't tell when the application was processing something and therefore busy.  This is in part due to the fact that when the application login is successful, they render it in a popup with no navigation or menus or anything.  So you can't see the "e" spinning or the progress bar.  I also suspect they are using a lot of AJAX calls as well but I digress

To solve this problem, New Co. put in this feature where if the app is processing something the screen greys out.  Cute?  Yes.  Informative to a human?  Yes.  Valuable to an automated test strategy?  NO!

And Here's why:  This "grey out" feature does not put the browser into a non-Ready state.  Now you may be wondering why this is such a big deal...I mean...surely the browser remaining in a Ready state is a great thing...right?

No--its not.  It sucks..and I'll tell you why.  The reason it sucks is that it makes "Sync" totally useless.  Sync basically asks the browser, "Are you done yet?" before attempting to proceed with the next lines of code.  Totally eliminates the need for the dreaded "Wait" statement.  Which is the automation equivalent of using a sledgehammer to open a peanut.

So what do I have to do to get around this?  I have to essentially make my own sync.  The annoying part of this is that I can't really use the same "sync" across the application.  I have to have one for each action I'm working on.  At least that's what I've been able to deduce for now, investigations into a more elegant solution continue.

For example:

'Verify Link under test exists
blnFound = False
intcount = 1
Do While blnfound = False
If Browser(Environment("BrowserHandle")).Page(Environment("PageHandle")). _
  & Link("innertext:="&strLinktext).Exist(0) Then
   blnfound = True
   blnfound = false
   intcount=intcount + 1
   If intcount > 10 Then
    Exit Do
   End If
 End if

So I basically have to turn what should be one line of code (Browser(Environment("BrowserHandle")).Page(Environment("PageHandle")).Sync ) into 14 lines of code, not including the DIM statements b/c I always use Option Explicit for my scripts.

And if I forget to build one of these little gems, the script runs so fast that I end up getting an application generated ViewState mismatch error OR it can't find the next object it needs b/c either the object is disabled thanks to that grey out dealie...or it doesn't exist yet b/c the application is attempting to navigate to the page where that object lives.


Anyone have any suggestions on this?  Aside from asking the devs that when the app greys out to put the browser in a non-ready state...which I am planning to do btw.


Posted on Wednesday, October 22, 2008 9:24 AM QuickTest Pro | Back to top

Comments on this post: WebApp is busy, but browser is "Ready"

# re: WebApp is busy, but browser is "Ready"
Requesting Gravatar...
Hi MaryAnne - here is a low-tech solution(unless you REALLY need to do totally unattended testing) Instead of all that other logic, put the line
msgbox "click OK when the greyed -out screen goes away"
before every sync point in your test. After you get this rolling, you will be in better shape to think of a more elegant solution -somewhere in the universe one exists- given time and exposure to your app, I could probably come up with one.. at least just one VBScript Sub that did the sync'ing part & just pass it the various sync points of interest as args... Writing individual custom logic around every sync point is not elegant. tell your boss that overnight testing stuff is mostly tool vendor snake oil anyway<g>. cheers - Mike Tierney
Left by Mike Tierney on Oct 28, 2008 1:43 PM

# re: WebApp is busy, but browser is "Ready"
Requesting Gravatar...
Unfortunately we're expected to have "totally unattended" execution. IE Overnight type runs eventually. :( So I've got to battle this thing. I'll keep you guys posted on my progress. :)
Left by MES on Oct 30, 2008 11:45 AM

# re: WebApp is busy, but browser is "Ready"
Requesting Gravatar...
Not sure fi this would work but what happens if you mange to override the in built sync functionlaity with your customised sync functionality ... i.e search for 'Registering User-Defined Test Object Methods' in QTP help.
Left by dp on Nov 25, 2008 9:21 AM

# re: WebApp is busy, but browser is "Ready"
Requesting Gravatar...
I am using a custom SYNC already which checks to make sure the Browser, or Browser.Page or Browser.frame object is reporting a ready status. The "greyed out" screen does not appear to put the browser in a non-ready status. My guess is that it is an AJAX call and therefore doesn't cause the browser to refresh. :(
Left by MES on Nov 25, 2008 4:55 PM

# re: WebApp is busy, but browser is "Ready"
Requesting Gravatar...
This is AJAX Controls Problem.I we cant know that how QTP hanle(Recognize) Ajax controls then only we can solve this problem. If anubody have idea regarding ajax with QTP send me the details. Then i will surely solve this syncronazation problem.
Left by joginder on Apr 06, 2009 1:11 AM

# Any solution to this?
Requesting Gravatar...
Did you ever find a neat solution to this? I'm having this same issue and I'm resorting to putting in lots of checks to see if objects are disables or not, but that only works if the processing in the background causes some objects to change state. I would love to be able to get a working ajax sync.
Left by Shawn Dowler on May 11, 2011 7:02 PM

# re: WebApp is busy, but browser is "Ready"
Requesting Gravatar...

One of the better solutions I have found and am now employing on a SAP Portal INterface is the one by Anshoo at this URL:

Once you get used to using his object it makes working with Ajax and Ajax-like stuff much easier.

How does his code work? Anshoo counts the number of objects and in each iteration if the number changes, you must still be downloading elements. If the element count stabilizes, then wait for a user defined time in seconds before exiting the SyncObjects class function.

Pretty simple and I can vouch for its operations.
Left by Greg on Mar 05, 2012 3:12 AM

Your comment:
 (will show your gravatar)

Copyright © Maryanne Sweat | Powered by: