Regarding Drop and Drag functionality

Class library usage, coding and language questions.
krany
Posts: 9
Joined: Sun Mar 30, 2014 4:52 pm

Regarding Drop and Drag functionality

Post by krany » Tue Apr 01, 2014 2:05 pm

Hi Ranorex Team,
I am currently working on an application where I need to check the Drag and Drop functionality .
I've recorded and played this it's working now that I want to do the same using scripting I kindly request you to help me in this as it is urgent.

For example: Take IGOOGLE, in that page if you take we have widgets present on the page. Now I want to drag the from one position to the other position by scripting. Also I want to verify their positions on the page. Could you or someone of you help me in doing this...


Thanks in advance,
Krany

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Regarding Drop and Drag functionality

Post by Deepak_Singh » Tue Apr 01, 2014 6:43 pm

Hi,

I also used this as suggested for igoogle.com

works fine while recording but gud question as far as scripting is concerned.

Can someone help us here. :?:

Thanks,
Deepak

krany
Posts: 9
Joined: Sun Mar 30, 2014 4:52 pm

Re: Regarding Drop and Drag functionality

Post by krany » Wed Apr 02, 2014 5:28 am

Hello Ranorex Support Team/anyone,
Could you help us on how to use drag and drop by scripting ... :roll:
Yes/No May be :|

Thanks In Advance 8)
Krany

krany
Posts: 9
Joined: Sun Mar 30, 2014 4:52 pm

Re: Regarding Drop and Drag functionality

Post by krany » Wed Apr 02, 2014 12:04 pm

Ok..alright!! :oops:

Atleast can someone tell me if drag and drop is possible through Ranorex using Scripting.

I want only using scripting "NOT RECORDING" :roll:

Thanks and Regards,
Krany 8)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Regarding Drop and Drag functionality

Post by odklizec » Wed Apr 02, 2014 12:50 pm

Hi,

It surely is possible to perform D&D via code. I'm currently outside my Ranorex machine, so I can't help you out with exact code. However, since you already tried to record a scenario, the easiest way to find out the Drag&Drop code, is to convert your existing recorded steps to user code. Simply, right click the recorded step (or steps) and from the appeared context menu select "Convert to User Code" item. Then examine check the code in UserCode.cs belonging to your recording. Hope this helps?
Last edited by odklizec on Thu Apr 03, 2014 6:21 am, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krany
Posts: 9
Joined: Sun Mar 30, 2014 4:52 pm

Re: Regarding Drop and Drag functionality

Post by krany » Thu Apr 03, 2014 5:47 am

Thank you so much for the reply :D
Will try this and get back to you 8) :roll:

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Regarding Drop and Drag functionality

Post by odklizec » Thu Apr 03, 2014 6:24 am

You are welcome and good luck! ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Regarding Drop and Drag functionality

Post by Deepak_Singh » Thu Apr 03, 2014 8:17 am

Hi odklizec,

The idea of checking from the Recording and then from Converting to user code module is not helping much.

Could you please do it with scripting taking igoogle as reference and update the same here.
Because when i am doing the same here then my test case is getting Passed but no Drag and Drop is happening.

Please help with the same.

Thanks In Advance,
Deepak

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Regarding Drop and Drag functionality

Post by odklizec » Thu Apr 03, 2014 8:24 am

Hi Deepak,

Isn't the igoogle a dead horse? https://support.google.com/websearch/an ... 4197?hl=en
Or is there an igoogle alternative (if so, please provide a link)? Sorry, I've never used igoogle in the past ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Regarding Drop and Drag functionality

Post by Deepak_Singh » Thu Apr 03, 2014 10:54 am


krany
Posts: 9
Joined: Sun Mar 30, 2014 4:52 pm

Re: Regarding Drop and Drag functionality

Post by krany » Thu Apr 03, 2014 11:15 am

Hi odklizec,
I tried converting it to the user code module and doing it, although I could not succeed in dragging the object the test case is passed.

This is my code,
***********************************************************************************************************
var indicesBasketBuilder = repo.PageName.IndicesBasketBuilder;
indicesBasketBuilder.Click();
Delay.Milliseconds(100);

var returnsAndVolatilityAnalysis = repo.PageName.ReturnsAndVolatilityAnalysis;

Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left);
Delay.Milliseconds(100);

repo.PageName.ReturnsAndVolatilityAnalysis("104;10");
Delay.Milliseconds(1000);

Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left);
Delay.Milliseconds(100);
*************************************************************************************
when I execute this, it;s getting passed but it is not dragging.
1 thing to notice here there is some message being showed during runtime, I am attaching that also in this post .
Kindly what that error or message means and I request you, if possible to provide the script from your end.

Thanks In Advance,
Krany
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Regarding Drop and Drag functionality

Post by odklizec » Thu Apr 03, 2014 12:45 pm

@krany,

It's hard to what could be a reason of your problem without seeing your app or at least the snapshot taken from your app.

Basically, Drag&Drop is nothing else than just Mouse Down >> move to new position >> Mouse Up sequence. There seems to be missing Mouse Up step in your code? So this may be a reason why it fails to drag&drop.

The reason why the test passed is that the steps probably did what they were instructed to do (e.g. move mouse from A to B). It would be good to add a Validation step after D&D operation, which would verify that the element has been correctly dropped at expected position.

I would suggest you to check for example these posts:
http://www.ranorex.com/forum/how-to-per ... -t856.html
http://www.ranorex.com/forum/not-record ... tml#p15099

Also, make sure there is disabled Turbo mode for replay, as it may cause problems with D&D of certain objects (as mentioned in one of the links).

@Deepak, I've tried to record D&D of "Google News" section (at https://www.ighome.com) and it replayed OK for me (both recorded steps and converted steps to code). So maybe I was just lucky choosing the "proper" element or you were unlucky to select an object, which is not so easily draggeable? ;) Anyway, take a look at the above mentioned topics or eventually, search for some other Drag and Drop related topics. There are several discussions on that subject.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Regarding Drop and Drag functionality

Post by mzperix » Thu Apr 03, 2014 5:46 pm

Hi,

I tried to automate the pages, but if you try it in google chrome, then Ranorex cannot identify the different elements. If I switched to FF, then the identification worked.

First, try to make the recording in FF, then you should have some proper elements, and then watch the generated code.

Second, this is how Drag and Drop goes in Ranorex way:
1. Identify the object that needs to be dragged --> elementToDrag
2. Identify the place where you want to drop --> elementPlace
3. Put a mouseDown action on elementToDrag
4. Put a mouseMove action to elementPlace
5. Put a mouseUp action on elementToDrag

If you have a succesful recording on Drag and drop then you would have:
- the two elements in repository
- the three actions in actiontable

Now you can have some idea on how to make some coding with Ranorex.

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Regarding Drop and Drag functionality

Post by Deepak_Singh » Thu Apr 03, 2014 9:19 pm

Hi,

I was successfully able to drag and drop different elements.

But my situation is as follows:
1. There is a workspace
2.There is a button named "Gallery"
Note:-After clicking gallery it opens as a different widget and that contains different other widgets.

3. There are different widgets in that gallery which are draggable to workspace.
4. Need to drag and drop the widgets from gallery to the workspace.
5. Once the work space contains widget again drag and drop them oo different place in the workspace(This is easy this i was able to do).

Now the main problem is The widgets in the gallery are there but Ranorex FAILS to click the object.

I added that into the repository and while clicking on the repository the item was highlighted(No problem).

But when i took the screenshot of the element at run time then its taking a total different element.

Now is there anyone who can help me.

Thanks,
Deepak

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Regarding Drop and Drag functionality

Post by odklizec » Thu Apr 03, 2014 9:36 pm

Hi,

I can only guess the path to the element is not enough unique. Eventually, make sure the folder caching is off... http://www.ranorex.com/support/user-gui ... html#c3285
It would be useful to see the snapshot and even better, the application itself.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration