@Tanya: I tried using the 'Text' property (I think because it's a label, it uses 'Text' instead of 'wText'), but it still gave me the same problem.
I found the problem(a few days after my first post). Just now have time to post back here just what I found, in case some one else runs into the same.
The line:
--------------
DM_dbPathFileName = Aliases.DataModelServer.HwndSource_MainWindow.MainWindow.DockPanel.Grid.mDMGroup.DockPanel.Grid.mMDMControlsPanel.WPFObject("StackPanel", "", 1).WPFObject("Border", "", 1).WPFObject("mDBFileLabel").get_Text();
-------------
Or the line:
----------
DM_dbPathFileName = Aliases.DataModelServer.HwndSource_MainWindow.MainWindow.DockPanel.Grid.mDMGroup.DockPanel.Grid.mMDMControlsPanel.WPFObject("StackPanel", "", 1).WPFObject("Border", "", 1).WPFObject("mDBFileLabel").Text;
----------
is where I'm getting the text from the field in the window that is open during the testing.
But, this does not copy the text into the var DM_dbPathFileName. What it does is copy a reference to the text location.
At the end of the testing, just before I tried to copy the data file created by the program under test, I close the program being tested. (Have to close the program to close the data file.) As a result of closing the program, the window where the text resides is closed. As a result of closing the window, the reference now points to nothing and results in an empty string.
Every direct copy of the text field that I tried resulted in copying the reference, not the actual text.
What I ended up doing was to extract the actual text by the following. (I made a function out of it in case I need to do it elsewhere.):
-------------------------
function GetActualText( Reference )
{
var ref = "'" + Reference + "'"; // Single quotes inside of double quotes.
var refText = aqString.SubString( ref, 1, aqString.GetLength( ref ) - 2 );
return refText;
}
-----------------------
Does anyone know if there is there a better way to force the actual text out of a reference to the text?