Regions.Items Method

Applies to TestComplete 15.62, last modified on March 19, 2024

Description

The Regions.Items method lets you obtain the Region object that provides a scripting interface to an item of the Regions collection.

Declaration

Regions.Items(RegionName)

RegionName [in]    Required    String    
Result A Region object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

RegionName

The unique name of the desired item in the collection. The item names are shown in the Name column of the Regions editor.

Result Value

The Region object that corresponds to the item with the given name.

Remarks

If the specified item does not exist, an error will occur. To check whether the specified item belongs to the collection, use the Contains method.

Example

The following code compares the image stored in the Regions collection with another image on hard drive:

JavaScript, JScript

function Test()
{
  StoredImage = Regions.Items("Image1");
  if (! StoredImage.Check("C:\\Images\\Image2.jpg"))
    Log.Error("The compared regions are not identical.");
}

Python

def Test():
  StoredImage = Regions.Items("Image1")
  if not StoredImage.Check("C:\\Images\\Image2.jpg"):
    Log.Error("The compared regions are not identical.")

VBScript

Sub Test
  Set StoredImage = Regions.Items("Image1")
  If Not StoredImage.Check("C:\Images\Image2.jpg") Then
    Log.Error "The compared regions are not identical."
  End If
End Sub

DelphiScript

procedure Test;
begin
  StoredImage := Regions.Items('Image1');
  if not StoredImage.Check('C:\Images\Image2.jpg') then
    Log.Error('The compared regions are not identical.');
end;

C++Script, C#Script

function Test()
{
  StoredImage = Regions.Items("Image1");
  if (! StoredImage.Check("C:\\Images\\Image2.jpg"))
    Log["Error"]("The compared regions are not identical.");
}

See Also

About Region Checkpoints
Add Method
GetPicture Method
AddPicture Method
Remove Method
Region Object

Highlight search results