Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drag and Drop Annoying QTP Behavior
#1
Not Solved
Hello all! So, I'm trying to drag and drop elements on a page. The script seems to work ONLY if the elements are visible on the screen. QTP does find the element but when it drags, the page automatically scrolls to the top, and it can't scroll back down to where it needs to drop the dragged element.

So my questions are:
Is there a way to scroll to the specified element and LOCK the scrolling?
Is there a way to stop QTP from jumping to the top of the page when it clicks on something?

Here is some code that I'm using. Ignore the numbers in SS_DragConstantSum, they will become variables later once I'm done testing. Also, both of these elements are not visible until I manually scroll down on the page.

QTP 11.53 P1
Chrome 30
Windows 7

Thank you Smile

Code:
'SS_DragFlags
'@Description Drag flags to a specified section in the field
'@Dcoumentation Drag the flag <Name> to the ruler
Public Sub SS_DragFlags(obj, Name)
    If obj.WebElement("class:=flag_container", "innerhtml:="&Name).Exist(5) Then
        obj.WebElement("class:=flag_container", "innerhtml:="&Name).Drag
        obj.WebElement("class:=ruler").Drop
    Else
        Reporter.ReportEvent micFail, "Flag: "&Name&" | Not found on page", ""
    End If
End Sub

RegisterUserFunc "Page" , "SS_DragFlags" , "SS_DragFlags"
'--------------------------------------------------------------------------------------------



'SS_DragCardSort
'@Description Drag cards to a specified section in the field
'@Documentation
Public Sub SS_DragCardSort(obj, CardIndex, DropZoneName)
    If obj.Image("class:=ui-draggable", "index:="&CardIndex).Exist(5) Then
        obj.Image("class:=ui-draggable", "index:="&CardIndex).Drag
        obj.WebElement("class:=OptionRow", "outertext:="&DropZoneName&".*").Drop
    Else
        Reporter.ReportEvent micFail, "Card Image: "&CardIndex&" or DropZone: "&DropZoneName&" | Not found on page", ""
    End If
End Sub

RegisterUserFunc "Page" , "SS_DragCardSort" , "SS_DragCardSort"
'--------------------------------------------------------------------------------------------

An example with CardSort on what happens if I want to put the card into Choice C:

Code centers the screen perfectly, but once the drag is executed...
[Image: 4Lx0y0Z.jpg?1]

It scrolls to the top of the page where it can't drop it in Choice C. This only happens when using drag, drop.
[Image: zHF8T99.jpg?1]

I want to avoid using coordinates as much as possible as they can obviously not be reliable depending on the contents of the page.
Reply
#2
Not Solved
I am facing the same issue, were you able to resolve it? Please do share information related to this.
Version - UFT12.02
Browser - Google Chrome

Summary of Issue - there is a tree panel where all values can be uniquely identified as webelements. As there are many values there is a scrollbar, I am able to drag the values which are at the top but if I try to drag the values for which scrolling is required UFT behaves weirdly i.e. it comes down automatically to drag the required webelemt and then automatically moves to the top! And also throws an error: "Invalid procedure call or argument".

Only object.Drag and object.drop work for me.
I have tried things like mercury Device replay (MouseDown, MouseUp, DragandDrop)

Tried insight recording, visual relation identifier, does not help.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unexpected Behavior of Reporter.Reportevent chinmaya chirasundara nayak 3 3,453 12-03-2013, 10:43 AM
Last Post: kotaramamohana
  QTP vbscript ArrayList strange behavior frankhovin 2 2,832 11-11-2013, 07:12 PM
Last Post: Parke
  Drop-Downs in excel sheet indianinworld 1 3,505 03-01-2011, 08:40 PM
Last Post: indianinworld
  Childobject weird behavior jsknight1969 5 4,172 02-26-2010, 10:31 PM
Last Post: jsknight1969
  Drop-down box mahadevan.swamy 5 4,120 11-03-2008, 12:47 PM
Last Post: amilar

Forum Jump:


Users browsing this thread: 1 Guest(s)