Launch a link. Click when an object is not displayed.

I am using UFT 12.51 to automate a web application in IE11. Here is my scenario:
I need to go through several pages to complete the process that I am trying to automate (more precisely, 9 pages). On page 4, I click on the link that opens the frame (like a popup). I enter the required information and press the button to send information that closes the frame and returns me to page 4 in the browser. My problems arise here: at this stage, the UFT stops recognizing any elements on the page. He takes away that there is a page, but does not recognize that it has child "visible" objects. If I manually click the link again to display the frame and close the frame, UFT will again begin to recognize objects on the page. Is there a way by which I can call the link (I have a URL) to re-open the frame when the link is not visible to UFT? If I can do it,I can close the frame and the objects on the page will be visible again .. I hope



I tried things like "devicereplay", browser.navigate, sendkeys, but none of them work. Unfortunately, due to the nature of my application, I cannot provide any screen prints. Any help would be greatly appreciated as I tried to figure this out for 2 days with no luck.

the code

Dim oDR : Set oDR = CreateObject("Mercury.DeviceReplay")
' Lets get the X and Y chordinates for 'Next Step' button
Dim iX, iY

iX = Browser("MyBrowser").Page("MyPage").Link("NextStep").GetROProperty("x") + 5
iY = Browser("MyBrowser").Page("MyPage").Link("NextStep").GetROProperty("y") + 5

If MyFunction(dCurrVals, sErrorMsg) Then
    LOG_ReportEvent "PASS", "Set Investment/Allocate", "Successfully initialised page"
Else
    LOG_ReportEvent "FAIL", "Set Investment/Allocate", sError
End If

'Browser("MyBrowser").Page("MyPage").Object.body.doscroll "scrollbarPageUP"
wait(1)

oDR.MouseMove iX, iY
oDR.MouseClick iX, iY, 0

Set oDR = Nothing

Browser("MyBrowser").RefreshWebSupport
Wait(1)
Browser("MyBrowser").Page("MyPage").Link("Search")
'Browser("MyBrowser").Navigate "MyURL"
'Browser("MyBrowser").Page("MyPage").Sync
'Browser("MyBrowser").Page("MyPage").Link
'Wait(1)
'Browser("MyBrowser").Page("MyPage").Link("Search")
'Browser("MyBrowser").Page("MyPage").WebElement("Search").FireEvent "onclick"


Note
For security reasons, I changed the names of the objects, but the above code is just an example of what I tried. dCurrVals- a dictionary object that is pre-populated before a function call

+4
source share
2 answers

. . , , -


UFT , InsightObject. InsightObject , , UFT . , : . UDF. UDF , InsightObject. , . , , . InsightObject, , .

UDF

Public Function EnablePage(ByVal oInsightObject, ByVal oCheckObject, ByVal iPgMoveCount ByRef sError)
    LOG_Write vbNewLine & "EnablePage"

    Dim oWS: Set oWS = CreateObject("WScript.shell")
    Dim iC
    Dim bFoundIO

    ' Set default values
    EnablePage = True
    bFoundIO = False

    ' Move to the top of the page
    For iC = 1 To CInt(iPgMoveCount)
        oWS.SendKeys "{PGUP}"
        Wait 0, 500
    Next

    ' Navigate to the bottom of the page to find the object
    For iC = 1 To CInt(iPgMoveCount)
        ' Check if Insight object exists
        If oInsightObject.Exist(1) Then
            bFoundIO = True
            oInsightObject.Click
            Wait 0, 500
            Exit For
        Else
            oWS.SendKeys "{PGDN}"
            Wait 0, 500
        End If
    Next

    ' Check if Insight object was found
    If bFoundIO Then
        ' Check if object to check is visible
        If Not oCheckObject.Exist(2) Then
            EnablePage = False
            sError = "Clicked on Insight Object but unable to find the object to check"
        End If
    Else
        EnablePage = False
        sError = "Unable to find the Insight Object"
    End If

    ' Clear objects
    Set oWS = Nothing

End Function
+2

UFT, HPE.

Browser("...").RefreshWebSupport, UFT DOM , , , : (

+1

Source: https://habr.com/ru/post/1666531/


All Articles