Testing Fly Out Menu in QTP

前端 未结 5 1985
别跟我提以往
别跟我提以往 2020-12-05 22:28

I am looking for ideas to trigger the actions for fly-out menus using QTP.

I am testing a Web App using QTP. The application has \"cascaded\" or hierarchical fly-out

相关标签:
5条回答
  • 2020-12-05 23:01

    I had a similar situation handled in slightly different manner, first click on the parent link Options then trigger the fireevent onclick with the help of ordinal identifier

    eg: browser().page().link(options).click

    browser().page().link("name:=preferences","html tag:=A","index:=X").firevent "onclick"

    This would ideally load the intended parent link & would be helpful in triggering fire event on click- Hope this helps.

    0 讨论(0)
  • 2020-12-05 23:05

    For the reason of loosing multitasking while QTP is executing, I did not implement with Motti's suggesiton. So instaed I ended up going through the HTML code to see which mouse events are expected by the java script. It turns out i need to call the below sequences:

    Link("Options").FireEvent ("onmouseover")
    WebElement("Preferences").FireEvent ("onmouseover")
    WebElement("Preferences").FireEvent ("onClick")
    

    This trick works really nice, but the risk here is if they change any thing drastically (say instaed of litening to Click if they use onMouseDown) I need to tweak the test script.

    0 讨论(0)
  • 2020-12-05 23:06

    If Click doesn't do the job then there are probably other events that the web app is expecting that are not simulated by QTP. One way to work around this is to turn on Web's Device Replay mode:

    Setting.WebPackage("ReplayType") = 2 
    

    After this line in the test whenever QTP sees a Click step it will replay it by moving the mouse over the element and simulating a click so all the events that are fired by human beings will be fired.

    To go back to the default event replay mode set "ReplayType" to 1.

    0 讨论(0)
  • 2020-12-05 23:22

    I have one more option. use this to click on any object.

    Set objMenu = Browser("Browser").Page("Pagel").WebElement("Menu_ELM")
    Set objDeviceReplay1 = CreateObject("mercury.devicereplay")
    x = objMenu.GetROProperty("abs_x")
    y = objMenu.GetROProperty("abs_y")
    objDeviceReplay1.MouseClick x + 35 , y + 5,0
    Set objDeviceReplay1 = Nothing
    
    0 讨论(0)
  • 2020-12-05 23:23

    Here's what I did with a similar problem:

    Set desPrefLink = Description.Create
        desPrefLink("micclass").value = "Link"
        desPrefLink("innertext").value = "Preferences"
    
    Browser(X).Page(Y).Link(desPrefLink).Click()
    

    It might not work with a more dynamic Javascript menu, though.

    0 讨论(0)
提交回复
热议问题