ZennoLab Assemblies Documentation
Document Class
Members  Example 
Represents a document on a Web page. Contains the methods to search for html elements, gets or sets of values.
Object Model
Document Class
Syntax
public class Document : System.MarshalByRefObject 
Remarks
This class does not contain constructors.The documents is available only from the Tab object or the Instance object. The Document class contain the properties such as ErrorDetected, IsNull and IsVoid. Their use necessary for the correct work of your code.
Example
This example uses the Document object to search for html elements and setting their values​​.
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
    // clear cookie
    instance.ClearCookie();
    
    // go to lessons.zennolab.com
    Tab tab = instance.ActiveTab;
    if ((tab.IsVoid) || (tab.IsNull)) return -1;
    if (tab.IsBusy) tab.WaitDownloading();
    tab.Navigate("lessons.zennolab.com", "");
    if (tab.IsBusy) tab.WaitDownloading();
    
    // get main document
    Document doc = tab.MainDocument;
    
    // find element by attribute
    HtmlElement he = doc.FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
    if (he.IsVoid) return -1;
    // set value
    he.SetValue("true", "Middle", true);
    
    // find element by name
    he = doc.FindElementByName("rad");
    if (he.IsVoid) return -1;
    
    // set value
    he.SetValue("0", "Middle", true);
    
    return 0;
}
public static function Execute($instance, $project)
{
    // clear cookie
    $instance->ClearCookie();
    
    // go to lessons.zennolab.com
    $tab = $instance->ActiveTab;
    if (($tab->IsVoid) || ($tab->IsNull)) return -1;
    if ($tab->IsBusy) $tab->WaitDownloading();
    $tab->Navigate("lessons.zennolab.com", "");
    if ($tab->IsBusy) $tab->WaitDownloading();
    
    // get main document
    $doc = $tab->MainDocument;
    
    // find element by attribute
    $he = $doc->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
    if ($he->IsVoid) return -1;
    // set value
    $he->SetValue("true", "Middle", true);
    
    // find element by name
    $he = $doc->FindElementByName("rad");
    if ($he->IsVoid) return -1;
    
    // set value
    $he->SetValue("0", "Middle", true);
    
    return 0;
}
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      ZennoLab.CommandCenter.Document

Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows Seven

See Also

Reference

Document Members
ZennoLab.CommandCenter Namespace
Tab Class
HtmlElement Class
Instance Class
DocumentCollection Class

Send Feedback