Zennolab.CommandCenter
IndexOf Method
See Also  Example Send Feedback
Zennolab.CommandCenter Namespace > HtmlElementCollection Class : IndexOf Method
element

Type: Zennolab.CommandCenter.HtmlElement

The document to locate in the HtmlElementCollection.

Searches for the specified object and returns the zero-based index of the first occurrence within the entire HtmlElementCollection.

Syntax

C# 
public int IndexOf( 
   HtmlElement element
)

Parameters

element

Type: Zennolab.CommandCenter.HtmlElement

The document to locate in the HtmlElementCollection.

Return Value

Type: System.Int32

The zero-based index of the first occurrence of item within the entire HtmlElementCollection, if found; otherwise, –1.

Example

The following code example demonstrates uses of the IndexOf method.
C#Copy Code
instance.ClearCookie();
 
Tab tab = instance.MainTab;
if ((tab.IsVoid) || (tab.IsNull)) return -1;
if (tab.IsBusy) tab.WaitDownloading();
tab.Navigate("lessons.zennolab.com");
if (tab.IsBusy) tab.WaitDownloading();
 
HtmlElementCollection heCol = tab.FindElementsByTags("input:checkbox");
        
HtmlElement he = heCol.Elements[heCol.Count-1];        
            
int index = heCol.IndexOf(he);
PHPCopy Code
$instance->ClearCookie();
 
$tab = $instance->MainTab;
if (($tab->IsVoid) || ($tab->IsNull)) return -1;
if ($tab->IsBusy) $tab->WaitDownloading();
$tab->Navigate("lessons.zennolab.com");
if ($tab->IsBusy) $tab->WaitDownloading();
 
$heCol = $tab->FindElementsByTags("input:checkbox");
        
$he = $heCol->Elements[$heCol->Count-1];        
            
$index = $heCol->IndexOf($he);

Remarks

The HtmlElementCollection is searched forward starting at index and ending at the last element.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2011 All Rights Reserved.