Forum Discussion

Magnus76's avatar
Magnus76
Occasional Contributor
14 years ago

Basic Keyword test for silverlight web page.

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />





Hi

I'm getting nowhere with testcomplete 7.52. Hope someone can help me.



I'm running a basic keyword test for testing web page. The problem I'm experience
is that I have a short script method that runs in the keyword test. The script
takes an Autocompletionbox and a string as input parameters. The script used
the passed string
parameter to find a child object for the past AutomationCompletionboxobject.



This script works fine for about 90% of the AutocompletetionBox objects. I'm
having a problem with the other 10%. The script I use is as follow:

procedure SelectDropDownItem(ADropDownObj : OleVariant; AItem : string);

  var

    fItemobj : OleVariant;

begin

  ADropDownObj.Click();

  ADropDownObj.Expand;

  ADropDownObj.Refresh;  

  fItemobj := ADropDownObj.FindChild('NativeUIAObject.Name',AItem);

  fItemobj.Refresh;

  fItemobj.AddToSelection;

  ADropDownObj.Collapse;

end;



When the script runs the ADropDownObj is correct, it also finds the child
object and store it to the fItemobj variable. When inspecting the fItemobj, the
method AddToSelection is shown under UI Automation group of the methods tab,
but if the script tries to execute the script line (fItemobj.AddToSelection;)
it complains that the AddToSelection method does not exist.



This does not make sense, why does it show if I inspect the actual variable,
but if the script tries to execute the method of the variable it cannot find
the method.



I'm currently running Windows Vista (32) with Testcomplete 7.52.

Memory: 2 GB

CPU: AMD Athlon X2 Dual Core Processor 5200+ 2.7GHz

Silverlight Version: 4.0.50524.0



any help would be appreciated.

Regards

Magnus



1 Reply


  • Hi Magnus,





    Check whether the fItemobj variable exists and let me know results when the problem occurs.







      fItemobj := ADropDownObj.FindChild('NativeUIAObject.Name',AItem);

      Log.Message(fItemobj.Exists);

      fItemobj.Refresh;

      Log.Message(fItemobj.Exists);

      fItemobj.AddToSelection;