Testing Copy/Paste from Excel automatically

Ranorex Studio, Spy, Recorder, and Driver.
ranisti
Posts: 5
Joined: Mon Sep 24, 2012 5:02 pm

Testing Copy/Paste from Excel automatically

Post by ranisti » Mon Sep 24, 2012 5:09 pm

Hi,

one feature of our application is to allow the user simply copy/paste bigger tables ans save it.

Is it possible to record it via Ranorex?

I have tried to record the mouse movement but it was not successful.

Thank you for your help.

With kind regards

It is also OK, if Ranorex copies the complete table in our application

If I understand well this code should make it:

---------------------------------------------------------

TestData testData;

openFileDialog.DefaultExt = "xlsx";

openFileDialog.Filter = "XLS file (*.xls)|*.xls|XLSX file (*.xlsx)|*.xlsx|All files (*.*)|*.*";
if ( openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
this.tbExcelFile.Text = openFileDialog.FileName;
}

void InitExcelConnection()
{
string[] testDataInputs = new string[] { "Input1", "Input2", "Input3", "Input4" };
string[] testDataOutputs = new string[] { "Output1" };
if (System.IO.File.Exists(tbExcelFile.Text))
excelConnector = new ExcelConnector(this.tbExcelFile.Text,
testDataInputs, testDataOutputs, true,2);
else
throw new RanorexException(null,"Specified file does not exist!");
}

InitExcelConnection();

while ((testData = excelConnector.GetNext()) != null )
{
Ranorex.Control bt = null;
foreach (string str in testData.Inputs)
{
foreach (char c in str)
{
bt = calcForm.FindChildText(c.ToString());
Mouse.ClickControl(bt);
}
}
bt = calcForm.FindControlId(403);
// Compare calculator output with expected value
Ranorex.Validate.HasText(bt, testData.Outputs[0] + ", ",testData.Description + " validation",false);
}

---------------------------------------------------------
The question is where I put the path of the excel file and how to put the data in our form:

The path of the excel sheet:
D:\IntegrationTest\Mesap\MesapExplorer\MesapExplorer\Deskriptor
\Dimension_1000_Deskriptoren_hinfuegen.xlsx"

The path of the form: "/form[@title~'^Neue\ Deskriptoren\ anlegen']/element/element[1]"

It would be of course much better if CSV instead of XLS benutzt werden könnte. Is there any waxy to make (in this case of course not via Copy / Paste :-))


I.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Testing Copy/Paste from Excel automatically

Post by Support Team » Wed Sep 26, 2012 12:18 pm

Hello,

How do you want to copy/paste the tables into your application? How do you normally past the table in your application without Ranorex? Could you please send us a Ranorex Snapshot file? It would also be helpful to explain the issue a little bit more detailed. Did you already try to paste the table with the 'right mouse click -> paste' functionality?

Regards,
Bernhard
Ranorex Support Team

ranisti
Posts: 5
Joined: Mon Sep 24, 2012 5:02 pm

Re: Testing Copy/Paste from Excel automatically

Post by ranisti » Wed Sep 26, 2012 2:17 pm

Hi,

I open normaly an Excel Sheet, select an area, RMT--> Copy --> I go in our app --> select a grid, RMT --> paste.

The problem is, that these steps cannot be recorded in Ranorex. I cannot record the step "selecting an area".

I will make Snapshot and upload it.

Regards,

I.

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Testing Copy/Paste from Excel automatically

Post by artur_gadomski » Thu Sep 27, 2012 8:35 am

Did you try Shift key down Click first cell, click Last Cell, Shift key up?