1st time table-cell -> DoDefaultAction -> Extends: cell.client.text =ok
2nd time same table-cell DoDefaultAction -> Extends: cell.client, text isn't available.
With Ranorex-Spy or other MSAA-Tool, the text is available
Can be a Bug in the Ranorex-lib, accesses previous Elements ?
regards
Jörg
Bug in table-cell editing
I couldn't reproduce this issue with the Microsoft DataGridView Control sample.
You can download the sample application from:
http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx
The following code works for me:
Jenö
Ranorex Team
You can download the sample application from:
http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx
The following code works for me:
Code: Select all
// Find the element by name
Element contactRow7 = dataGridView1.Element.FindChild(Role.Cell, "Contact Name Row 7");
if (contactRow7 != null)
{
contactRow7.Value = "Ranorex";
// DoDefaultAction, wait 10 sec and read the text
for (int i = 0; i < 10; i++)
{
bool ddaRet = contactRow7.DoDefaultAction();
Application.Sleep(10000);
Console.WriteLine("DoDefaultAction ret={0} Text = {1}",
ddaRet, contactRow7.Value);
}
}
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
the effect occurs with a Xceed-gridcontrol, when i complete a Value-Set with a
Sendkeys("{ENTER}"). If i don't complete, the value isn't be set in the cell.
The problem is, that a Xceed-cell extends itself when i execute DoDefaultAction at the cell to a subchild-structur like: cell-cleint-window-text, and only this last text can be edited.
What can i do else to complete a Value-Set ? I think there should be a mechanism like "CompleteDefaultAction" after setting the Value in the underlying (and temporaer) Text-Child, to transfer this new value in the cell-Value.
Or i am completely wrong ???
Sendkeys("{ENTER}"). If i don't complete, the value isn't be set in the cell.
The problem is, that a Xceed-cell extends itself when i execute DoDefaultAction at the cell to a subchild-structur like: cell-cleint-window-text, and only this last text can be edited.
What can i do else to complete a Value-Set ? I think there should be a mechanism like "CompleteDefaultAction" after setting the Value in the underlying (and temporaer) Text-Child, to transfer this new value in the cell-Value.
Or i am completely wrong ???
I checked the XCeed-gridcontrol with the XceedGridLiveExplorer.exe. I think not all elements of the grid control supports accessibility. Please post me the steps i need to reproduce this issue with the XceedGridLiveExplorer.exe.
(I realised that in some cases you cannot complete an edit operation with Enter, but with the TAB key.)
Jenö
Ranorex Team
(I realised that in some cases you cannot complete an edit operation with Enter, but with the TAB key.)
Jenö
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
The variant a is ok, but i won't edit the table-cell with mouse-clicks and not with SendKeys, because while debugging it appears that the focus changes to visual-studio and the mouse/sendkey-actions will be executed in this and not in the test-form.
In variant b, the 1st time is ok and the Exception occurs at the 2nd-time, then no editable text is found.
the used gridcontrol is a Exceed-gridcontrol
In variant b, the 1st time is ok and the Exception occurs at the 2nd-time, then no editable text is found.
the used gridcontrol is a Exceed-gridcontrol
Code: Select all
//variant a) ok
for(int i=1; i<10; i++)
{
Element e_ = f1.FindControlName("gridControl1").Element.FindChild(Role.Table);
Element el = e_.GetChild(3).GetChild(2); //get a cell
Mouse.ClickElement(el);
Application.SendKeys(Convert.ToString(i) + "{ENTER}");
}
//variant b) nok
for(int i=1; i<10; i++)
{
Element e_ = f1.FindControlName("gridControl1").Element.FindChild(Role.Table);
Element el = e_.GetChild(3).GetChild(2); //get a cell
el.DoDefaultAction(); //Edit
// get the editable text-element
if(el.GetChild(0).ChildCount >= 1)
{
Element el_ = el.GetChild(0).FindChild(Role.Text);
el_.Value = Convert.ToString(i);
Application.SendKeys("{TAB}");
}
else
{
throw new Exception("No Edit-Element available!");
}
}
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
no, i have already checked the time-behaviour, it has no effect.
Now i have another behaviour with (perhaps) same cause:
If i have read the child of a client 1 time, and a value-change happens, a new read returns the old value again. AccExplorer reads the correct (new) value after refresh.
- Here again: i guess, that i access old/obsolete elements the 2nd time
- Is there a refresh available in Ranorex ?
Now i have another behaviour with (perhaps) same cause:
If i have read the child of a client 1 time, and a value-change happens, a new read returns the old value again. AccExplorer reads the correct (new) value after refresh.
- Here again: i guess, that i access old/obsolete elements the 2nd time
- Is there a refresh available in Ranorex ?
It can be a bug, but we cannot reproduce it with Microsoft controls or applications.
I tried the following code with the Microsoft DataGridView Control sample:
You can download the sample application from:
http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx
Please send us a sample application with the test sources or post us the steps we need to reproduce the bug with a Microsoft application like Microsoft DataGridView Control sample.
Jenö
Ranorex Team
I tried the following code with the Microsoft DataGridView Control sample:
You can download the sample application from:
http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx
Code: Select all
Control dataGridView1 = form.FindControlName("dataGridView1");
if (dataGridView1 == null)
{
Console.WriteLine("ERROR: dataGridView1 not found ");
return 1;
}
// Find the element by name
Element contactRow7 = dataGridView1.Element.FindChild(Role.Cell, "Contact Name Row 7");
if (contactRow7 != null)
{
for (int i = 0; i < 30; i++)
{
Application.Sleep(1000);
Console.WriteLine("Cell Value = {0}", contactRow7.Value);
}
}
Jenö
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm
It seems to be a problem in the Element cache functions, we will check this issue for the next version.
Please use the following workaround in V1.2:
1. Generate a textfile with the name Ranorex.ini
2. Insert the following text:
[General]
ElementCacheSize=4
3. Copy the file into the Ranorex Bin directory (RanorexCore.dll must be in the same directory).
After setting the new value, you must send an Enter with SendKeys or change the cell with DoDefaultAction:
Jenö
Ranorex Team
Please use the following workaround in V1.2:
1. Generate a textfile with the name Ranorex.ini
2. Insert the following text:
[General]
ElementCacheSize=4
3. Copy the file into the Ranorex Bin directory (RanorexCore.dll must be in the same directory).
After setting the new value, you must send an Enter with SendKeys or change the cell with DoDefaultAction:
Code: Select all
for (int i = 1; i < 10; i++)
{
Element e_ = f1.FindControlName("gridControl1").Element.FindChild(Role.Table);
Element el = e_.GetChild(3).GetChild(1); //get a cell
Element el2 = e_.GetChild(3).GetChild(2);
el.DoDefaultAction(); //Edit
Element el_ = el.FindChild(Role.Text);
if (el_ != null)
{
string newval = Convert.ToString(DateTime.Now.Millisecond);
el_.Value = newval;
el2.DoDefaultAction(); // Change the cell
if (el.Value != newval)
{
throw new Exception("Value not comitted !");
}
else
Console.WriteLine("Value={0} OK",newval);
}
else
{
throw new Exception("No Editable Text available!");
}
}
Ranorex Team
-
- Posts: 55
- Joined: Thu Aug 23, 2007 12:00 pm