Page 1 of 2

Regarding Drop and Drag functionality

Posted: Tue Apr 01, 2014 2:05 pm
by krany
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

Re: Regarding Drop and Drag functionality

Posted: Tue Apr 01, 2014 6:43 pm
by Deepak_Singh
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

Re: Regarding Drop and Drag functionality

Posted: Wed Apr 02, 2014 5:28 am
by krany
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

Re: Regarding Drop and Drag functionality

Posted: Wed Apr 02, 2014 12:04 pm
by krany
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)

Re: Regarding Drop and Drag functionality

Posted: Wed Apr 02, 2014 12:50 pm
by odklizec
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?

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 5:47 am
by krany
Thank you so much for the reply :D
Will try this and get back to you 8) :roll:

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 6:24 am
by odklizec
You are welcome and good luck! ;)

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 8:17 am
by Deepak_Singh
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

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 8:24 am
by odklizec
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 ;)

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 10:54 am
by Deepak_Singh

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 11:15 am
by krany
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

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 12:45 pm
by odklizec
@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.

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 5:46 pm
by mzperix
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.

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 9:19 pm
by Deepak_Singh
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

Re: Regarding Drop and Drag functionality

Posted: Thu Apr 03, 2014 9:36 pm
by odklizec
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.