Drag and drop, WebElement

Hi,

I have WebElement in my applications. I must drag this element and move to another part of page, to WebTable.  How can I do that?

I add to repository this WebElement then I do:

...WebElement("...")Drag

(I don't know that coordinates x and y that object are necessary?)

then I use the same object...WebElement("...")Drop x, y (x, y where I want to move this element)

and I have error:

"The drag and drop operation cannot be performed because the values you specified in the Drop step exceed the boundaries of the Web frame"

 

I tried also use another object (that is in this place where I want to move my object), to drop function ..WebElement("...")Drop (I added also coordinatest)

but still don't work.

 

Maybe someone explain how should correctry using drag and drop, because now I try "Trial and error"

 

Parents
  • Hi mariozx,

    UFT supports the following scenarios for Web Drag and Drop operations:

    • Scenario A: One object is dragged onto another object. For example, you can drag a WebButton from one frame object (source object) to another object (target object), or drag a WebElement (source object) onto a Link object (target object) in the same frame.
    • Scenario B: An object is moved from one location in a frame to another location in the same frame. In this case, the test object used for the Drag step is the same as the test object used for the Drop step.
    • Scenario C: An item within an object is moved to another location within that object (also known as drag and pan). For example, in a map application, you can relocate an image relative to itself or drag a Slider object.

    In your case, you are applying scenario A, therefore you will need to perform the Drag operation on the WebElement and the Drop operation on the WebTable.

    As per the coordinates, both Drag and Drop operations take the x and y arguments as the coordinates within the source object which is probably why you receive the out of bounds exception. For both methods, you can specify no coordinates, in which case the center of the source/target object will be considered. 

    In summary, please try running:

    ...WebElement("...").Drag

    ...WebTable("...").Drop

    I hope it helps!

    Kind Regards,

    Francisca

Reply
  • Hi mariozx,

    UFT supports the following scenarios for Web Drag and Drop operations:

    • Scenario A: One object is dragged onto another object. For example, you can drag a WebButton from one frame object (source object) to another object (target object), or drag a WebElement (source object) onto a Link object (target object) in the same frame.
    • Scenario B: An object is moved from one location in a frame to another location in the same frame. In this case, the test object used for the Drag step is the same as the test object used for the Drop step.
    • Scenario C: An item within an object is moved to another location within that object (also known as drag and pan). For example, in a map application, you can relocate an image relative to itself or drag a Slider object.

    In your case, you are applying scenario A, therefore you will need to perform the Drag operation on the WebElement and the Drop operation on the WebTable.

    As per the coordinates, both Drag and Drop operations take the x and y arguments as the coordinates within the source object which is probably why you receive the out of bounds exception. For both methods, you can specify no coordinates, in which case the center of the source/target object will be considered. 

    In summary, please try running:

    ...WebElement("...").Drag

    ...WebTable("...").Drop

    I hope it helps!

    Kind Regards,

    Francisca

Children
  • Thank you, but I still cannot do drag and drop. In first post I wasn't precise. Target is another WebElement that belongs to WebTable. I tried  source .WebElement("...").Drop  and ..WebTable("...").Drop and I get error in my native language in line Object.Drop: Incorrect call procedure/sub or incorrect argument. I think it is VBScript error. Both object have operations .Drop

     

     

  • Hi,

    If the target is another WebElement that belongs to a WebTable, then please try instead:

    ...WebElement("...").Drag

    ...WebTable("...").WebElement("...").Drop

    Please make sure that both objects are added to the object repository before trying to run the code. If you still receive the error message, could you please share the exact code that you are running? Also, would it be possible for you to share a sample html containing the objects to drag and drop?

    Thank you!

    Kind Regards,

    Francisca

  • Hi,

    If the target is another WebElement that belongs to a WebTable, then please try instead:

    ...WebElement("...").Drag

    ...WebTable("...").WebElement("...").Drop

    Please make sure that both objects are added to the object repository before trying to run the code. If you still receive the error message, could you please share the exact code that you are running? Also, would it be possible for you to share a sample html containing the objects to drag and drop?

    Thank you!

    Kind Regards,

    Francisca

  • Hi,

    If the target is another WebElement that belongs to a WebTable, then please try instead:

    ...WebElement("...").Drag

    ...WebTable("...").WebElement("...").Drop

    Please make sure that both objects are added to the object repository before trying to run the code. If you still receive the error message, could you please share the exact code that you are running? Also, would it be possible for you to share a sample html containing the objects to drag and drop?

    Thank you!

    Kind Regards,

    Francisca

  • Verified Answer

    Hi Francisca,

    I solved my problem. I used DeviceReplay method - MouseDown and MouseUp. Method DragAndDrop doesn't work in my case.

    Thank you. for your posts. I have question about: ...WebTable("...").WebElement("...").Drop

    When I do ObjectSpy on this element I see full object hierarchy: Browser -> Page -> WebTable-> WebElement

    When I put this object to code is only: Browser("...").Page("..").WebElement("...")

    It is possible to put into code full hierarchy this object like ...WebTable("...").WebElement("...").Drop?

  • Hi,

    I am glad that your problem is solved!

    Regarding your question, the fact that the objects are added differently to the repository to the way in which they are displayed in the object spy is due to a design condition to prevent too many levels in the object repository. However, if you wish, you can modify the object hierarchy in the object repository moving the WebElement under the WebTable and then use it in the script as: WebTable("...").WebElement("...")

    Kind Regards,

    Francisca

  • Hi Francisca,

    Thank you for your explanation.

    Regards,

    M

  • Hi mariozx,

    I was following your query on drag and drop objects.

    And i am facing the same problem as yours and i got to know that it is solved by DeviceReplay method.

    Could you please help me to solve the same as my issue is exactly same as yours.

    Looking for your reply.

    Thank you.

     

  • Hi all,

    I am facing a problem when using drag and drop functions on a remote machine. Basically, on my local machine it runs without problems and even on the remote machine (when my RDP session is connected) is running without problems. The problem is when I have my RDP session disconnected, the test fails always on drag and drop functions .. I don't have the error on drag and drop itself but on the checkpoint immediately after ...

    Is there anyone that can help me?

    Here is the code, i'ts very simple ...

    Browser("ICA").Page("PersViews Certificate").WebElement("CertificateID").Drag
    Browser("ICA").Page("PersViews Certificate").WebElement("DropPoint1").Drop
    Browser("ICA").Page("PersViews Certificate").WebButton("Save").Click

    Many thanks,

    Diogo Cruz

  • hi, there

    Please check this doc from the online Help:

    https://admhelp.microfocus.com/uft/en/15.0-15.0.1/UFT_Help/Content/User_Guide/RunYourTest_DisconnectedRDP.htm

    the idea is that there's an option in UFT to enable continuing the execution after you disconnected from your remote session. You may need to provide the machine's credential.

    Thanks.

    James