Drag And Drop From Grid Views in silverlight

Jul 14, 2010 at 5:19 PM
Edited Jul 14, 2010 at 5:46 PM

Hello All,

I have a Test application is Silverlight 4 with two Telerik Grids. I am using Telerik RAD Controls. I am able to identify the Grids and the Rows. When I try to Drag a row from Grid 1 and Drop to Grid 2 the automation test does not succeed. Please find below the code I have used.

 

Let me know where I am doing it Wrong. Is there any other way I can do this.

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

using White.WebBrowser.Silverlight;
using White.WebBrowser;
using White.Core;
using White.Core.UIItems;
using White.Core.UIItems.ListBoxItems;
using White.Core.UIItems.TabItems;
using White.Core.UIItems.TableItems;
using White.Core.InputDevices;

namespace SilverWhite
{
    class Program
    {
        static void Main(string[] args)
        {
            string appLink = "http://localhost/DragDropGridRows/SeleniumTestTestPage.html";
            string title = "SeleniumTest - Windows Internet Explorer";
            
	    InternetExplorerWindow browserWindow = InternetExplorer.Launch(appLink, title);
            browserWindow.WaitWhileBusy();
            SilverlightDocument document = browserWindow.SilverlightDocument;
            
            White.Core.UIItems.TextBox status = document.Get<White.Core.UIItems.TextBox>("textBox");
            White.Core.UIItems.ListView dropRow = document.Get<White.Core.UIItems.ListView>("GV2");
            White.Core.UIItems.ListView selRow = document.Get<White.Core.UIItems.ListView>("GV1");
            White.Core.UIItems.ListViewRow row = selRow.Rows[1];
            
            status.Enter(status.Text + "\ncode:" + row.Cells[0].Text);
            status.Enter(status.Text + "\nDrink:" + row.Cells[1].Text);
            selRow.Rows[2].Click();

            /* Method 1 */
            Mouse.Instance.DragAndDrop(row, dropRow);


            /* Method 2 */
	    //Mouse.LeftDown();
            //Mouse.Instance.DragVertically(row, 300);
            //Mouse.LeftUp();

        }

    }

}

 

Coordinator
Jul 18, 2010 at 1:20 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.