FireFox 31.6 ESR issues

Bug reports.
User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

FireFox 31.6 ESR issues

Post by Aracknid » Wed Apr 08, 2015 4:19 pm

I'm using Ranorex 5.2.2 and I've run into an issue with FF 31.6 ESR. I also updated to 5.3.1 and still experienced the same issue.

The issue doesn't occur with IE 11, and it didn't happen with FF 31.2 ESR (the last time I tested using FF). I'm not sure about FF versions in between.

The issue doesn't always happen. But it happens more than 50% of the time.

I tried uninstalling and re-install Ranorex after FF 31.6 was installed, and re-activated the FF plug-in. didn't help.

Here is what is happening:

When I log into my app multiple times as different users, I'll have multiple FF DOM objects. Ranorex thinks both DOMs are the Exact same. I've noticed that in the Spy tool, when I switch between selecting them, the Path Editor will show "/dom[1]" or "/dom[2]". Also, spying on lements won't work as expected.

When the problem doesn't happen, it will show a longer path, which includes the the PageURL property of the DOM, since this is the difference between them, so it will show something like "/dom[http://servername/pagename.aspx?ID1={GUID1}&ID2={GUID2}". Both DOMs should have different GUIDs for both parameters and they should be different than the other DOMs.

Help.

Aracknid

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: FireFox 31.6 ESR issues

Post by Support Team » Thu Apr 09, 2015 12:54 pm

Hello Aracknid,

It seems like the issue is somehow related to your application under test since we didn't face any recognition issues with FF 31.6 ESR so far. May I ask if there is a possibility to reproduce the aforementioned issue?

Regards,
Robert
.
Image

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: FireFox 31.6 ESR issues

Post by Aracknid » Thu Apr 09, 2015 4:40 pm

Hi,

Looks like the issue is NOT specific to 31.6 ESR... but a general FF issue. This is odd because I ran all my scripts in FF 31.2 a while ago and did not have this issue.

Perhaps it is a FF config issue too, because I have figured out how to get the problem to happen and how to fix it (with manual intervention).

Here's what I have figured out so far:

Working example:

1. Start FF (I'm using 31.5 at the moment, not 31.6)
2. Make sure the window is NOT maximized, so perhaps it is about 75% full screen size (but size doesn't matter)
3. In my case, I navigate to my login screen, and enter user name and password and hit login
4. We launch another window with our app for this logged in user. In this case, the spawned window is also 75% screen size. My code looks for this DOM in the collection of DOMs off the Host.Local root, looking at each DOM's PageURL because it will contain a parameter that has our session number in it for this logged in user.
5. When I find the Dom, I maximize it.
6. In this script, I have a second user login as well, so I switch back to the first DOM which is 75% screen size, refresh the page which asks me to log in
7. I log in as a second user. this launches another DOM at 75% size.
8. Again I look for this window based on session number in DOM pageURL. I find it and Maximize it.
9. No more logins, so I close the first DOM
10. Script continues, working no issues.....
11. When script is complete all browser windows are closed by user loging off.

Failed Example:

Lets say the next script to run is the same as above, only for different testing within the script. So it still needs to log in with the same 2 users, following the same process. I will highlight the problem differences:

1. Start FF (I'm using 31.5 at the moment, not 31.6)
2. The window is automatically in a maximized state when started. (This will be the problem moving forward)
3. In my case, I navigate to my login screen, and enter user name and password and hit login
4. We launch another window with our app for this logged in user. In this case, the spawned window is also MAXIMIZED. My code looks for this DOM in the collection of DOMs off the Host.Local root, looking at each DOM's PageURL because it will contain a parameter that has our session number in it for this logged in user.
5. When I find the Dom, I maximize it. (I guess nothing happens since it is already maximized)
6. In this script, I have a second user login as well, so I switch back to the first DOM which is MAXIMIZED, refresh the page which asks me to log in
7. I log in as a second user. this launches another DOM at MAXIMIZED size.
8. Again I look for this window based on session number in DOM pageURL. IT CANNOT FIND IT.

So this is where it is weird. The code is looking at ALL the DOMs and it knows there are 3, but the page URL for the last launched one is not correct. It's like the second one.

At this point if I manually hit the Browsers Restore button, which makes it 75% screen size, my script will now find it. (I'm in a loop looking for up to 30 seconds).

Here's my code that looks for the DOM based on the known session number in the PageURL (which is a class variable ms_SessionGUID). Also note that I cut out some info from the code, so if it doesn't compile I may have cut out too much, but trust me it works.
Public Overloads Function connectWindow(
            sExpectedURLPrefix As String,
            Optional iMaxTimeout As Integer = 30
    ) As Boolean

        '** Description:
        '**     Try to connection a window with url specified
        '**     replace mo_BrowserFormObj and mSessionWindow with this new window

        Dim lFootprint As String = "Module: " & mcs_ModuleName & ", Function: " & (New StackFrame()).GetMethod.Name & " :: "
        Dim ssessionid As String
        Dim OuterStarttime As Date
        Dim starttime As Date
        Dim sStrippedSessionID As String
        Dim BrowserDOM As WebDocument
        Dim BrowserDOMCollection As System.Collections.Generic.IList(Of Ranorex.Core.Element)
        Dim BrowserDOMState As String
        Dim sURL As String
        Dim sFindThis As String
        Dim iCountLoopTimes As Integer = 0
        Dim iRetryCount As Integer = 0

        Autoweb.logInfo(lFootprint & sExpectedURLPrefix)

        'Sometimes we pass in a iMaxTimeout value by passing in an enumWaitMaxTime, which is in milliseconds. We don't typically want to wait
        'For 1000 seconds = 16.666 minutes to connect to a window... so if the value is bigger than 100 I'll divide it by 1000 for you
        If iMaxTimeout >= 1000 Then
            iMaxTimeout = iMaxTimeout / 1000
        End If

        OuterStarttime = Now

        ' When Browser takes longer time to loadup, we will have no information about it if we look only once (it is possible to 
        ' run through this function before browser window even appears in processes).
        ' So loop until timeout or you find the one you are expecting
        Do While CInt(DateDiff("s", OuterStarttime, Now)) < iMaxTimeout And iRetryCount < 10

            Try

                iCountLoopTimes += 1

                BrowserDOMCollection = Host.Local.Find("/dom")

                'Now we need to look at each URL of each Browser DOM to see if it is the one we want
                For Each BrowserDOM In BrowserDOMCollection

                    BrowserDOMState = BrowserDOM.State.ToLower

                    If BrowserDOMState <> "invalid" Then ' do not check window with invalid status

                        starttime = Now
                        Do While (BrowserDOMState = "loading")

                            If CInt(DateDiff("s", starttime, Now)) >= iMaxTimeout Then
                                logError(lFootprint & "waited long enough for its status not LOADING")
                                Return False
                            End If
							
                            Ranorex.Delay.Seconds(1)
                            BrowserDOMState = BrowserDOM.State.ToLower
                            Autoweb.logInfo(lFootprint & "Loading Page....")
							
                        Loop

                        'Added the delay to give the dialog time to go from Loading to Complete and redraw....
                        Ranorex.Delay.Seconds(1)

                        'LocationURL is allcaps, needs LCase in order for InStr to match.
                        sURL = BrowserDOM.PageUrl.ToLower
                        sFindThis = sExpectedURLPrefix.ToLower

                        If InStr(1, sURL, sFindThis, CompareMethod.Text) > 0 Then 

                            ssessionid = ms_SessionGUID

                            'Remove the curly brackets from the session ID
                            'since some newer .NET code (master pages) and CSLA changes do not always include them.
                            sStrippedSessionID = Replace(ssessionid, "{", "")
                            sStrippedSessionID = Replace(sStrippedSessionID, "}", "")

                            'Check for both versions of the seesionID (with and without  { } )
                            If InStr(1, sURL, ssessionid, vbTextCompare) > 0 Or _
                                    InStr(1, sURL, sStrippedSessionID, vbTextCompare) > 0 Then
                                mo_BrowserWebDoc = BrowserDOM
                                mo_BrowserForm = BrowserDOM.Browser

                                mo_BrowserForm.EnsureVisible()

                                ms_LocationURL = sURL
								
                                Try
								
                                    'Added this wait. Might not be a good idea... but sometimes trying to 
                                    'get the Caption was getting nothing due to page loading...
                                    BrowserDOM.WaitForDocumentLoaded(EnumWaitTimePeriod.csMaxWaittimeLong)
                                    ms_LocationName = BrowserDOM.Element.GetAttributeValue("Caption")
									
                                Catch ex As Exception
								
                                    Autoweb.logError(lFootprint & "An exception occurred trying to get the browser window's caption. Exception message: " & ex.Message)
                                    Return False
									
                                End Try

                                Return True

                            Else

                                Autoweb.logInfo(lFootprint & "We found a Browser window with the correct URL, but not the correct session... will keep looking.")
                                Autoweb.logInfo(lFootprint & String.Format("Here is the DOM info: Actual URL: {0} Expected session: {1}", sURL, ssessionid))

                            End If

                        Else

                            Autoweb.logInfo(lFootprint & String.Format("Found a DOM with no match: Actual URL: {0} Expecting: {1}", sURL, sFindThis))
                            Autoweb.logInfo(lFootprint & "Time difference is: " & CInt(DateDiff("s", OuterStarttime, Now)).ToString)
                            Autoweb.logInfo(lFootprint & "Loop iteration is: " & iCountLoopTimes.ToString)

                        End If

                    End If

                Next

            Catch ex As RanorexException
			
                Autoweb.logInfo(lFootprint & "Didn't find any Browser Web Documents. Waiting 1 second and trying again...")
                Ranorex.Delay.Seconds(1)
				
            Catch ex As Exception
			
                Autoweb.logError(lFootprint & "An unexpected error occurred. Message: " & ex.Message)

                'Since we caught an error, lets pause and try again (up to 10 times)
                iRetryCount += 1
				
            End Try

            'If I didn't find what I'm looking for, I'll loop back and try again until I find it or timeout.
            'However, I need to pause a few seconds to give the system time to update. Without this pause, I found that there were issues and I'd
            'never find what I was looking for.
            Ranorex.Delay.Seconds(2)

        Loop

        Autoweb.logWarning(lFootprint & "No Browser Web Documents with a blank page appeared on screen within " & iMaxTimeout & " seconds timeout.")
        Autoweb.logInfo(lFootprint & "Time difference is: " & CInt(DateDiff("s", OuterStarttime, Now)).ToString)
        Autoweb.logInfo(lFootprint & "Loop iteration is: " & iCountLoopTimes.ToString)

        Return False

    End Function
I'm not sure why this worked a while ago when I ran in 31.2. Perhaps I changed Ranorex Version, or perhaps the system has had some FF settings messed up that I don't know about...

Does this help you recreate the issue?

Aracknid

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: FireFox 31.6 ESR issues

Post by Aracknid » Thu Apr 09, 2015 5:00 pm

Also, I just want to add that even though my first example above works (when they don't start maximized), once both the windows are maximized, Ranorex Spy will still only show "/dom[1]" and "/dom[2]" for the path. If I restore one and refresh the Spy and then click on them again, they suddenly show the full path with the different PageURL info.

To me, it looks like FF messes Ranorex up when the windows are maximized.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: FireFox 31.6 ESR issues

Post by Support Team » Fri Apr 10, 2015 12:49 pm

Hello Aracknid,

Thank you for the detailed explanation.

May I ask you to contact [email protected] for further investigations.

Thanks,
Robert
.
Image

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: FireFox 31.6 ESR issues

Post by Aracknid » Mon Jul 06, 2015 6:35 pm

Hi,

Has this been fixed in the recent releases (5.3.3 or 5.4)?

Thanks,

Aracknid

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: FireFox 31.6 ESR issues

Post by Support Team » Thu Jul 09, 2015 12:31 pm

Hi Aracknid,

No, unfortunately we did not find a solution on this issue so far.

Thank you for your understanding.

Regards,
Robert
.
Image