HtmlElement
Assembly: ZennoLab.CommandCenter
Full name: ZennoLab.CommandCenter.HtmlElement
Represents an HTML element on a Web page. Contains the methods to search for html elements, gets or sets of values.
The HtmlElement class contain the properties such as ErrorDetected, IsNull and IsVoid. Their use necessary for the correct work of your code.
Properties
ErrorDetected
Property
Gets information about the error detected in the performance last command.
If the HtmlElement object does not indicate to the real html element of dom model when this property is true. Also objects of this class contains IsNull and IsVoid properties for identification of element’s existence. Almost all classes of ZennoLab.CommandCenter contains such properties. Use it for the correct execution of the code.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// if error detected then exit with -1
if (he.ErrorDetected) return -1;
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// if error detected then exit with -1
if ($he->ErrorDetected) return -1;
return 0;
}IsVoid
Property
Gets the specified html element is void or not.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by attribute
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// if element is void then return -1
if (he.IsVoid) return -1;
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by attribute
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// if element is void then return -1
if ($he->IsVoid) return -1;
return 0;
}ZP_ID
Property
Gets the ID which represents html element on the server.
It is used only for the technical purposes
ParentTab
Property
Gets the parent tab.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent tab
Tab parentTab = he.ParentTab;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent tab
$parentTab = $he->ParentTab;ParentDocument
Property
Gets the parent document.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent document
Document parentDocument = he.ParentDocument;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent document
$parentDocument = $he->ParentDocument;ParentElement
Property
Gets the parent element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent element
HtmlElement parentElement = he.ParentElement;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent element
$parentElement = $he->ParentElement;ParentForm
Property
Gets the parent form.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent form
HtmlElement parentElement = he.ParentForm;Example2
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent form
$parentElement = $he->ParentForm;ParentBody
Property
Gets the parent body.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent body
HtmlElement parentBody = he.ParentBody;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get parent body
$parentBody = $he->ParentBody;ContentDocument
Property
Gets the content document for frame/iframe element.
FirstChild
Property
Gets the first child element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get first child
HtmlElement first = he.FirstChild;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get first child
$first = $he->FirstChild;LastChild
Property
Gets the last child element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get the last child
HtmlElement last = he.LastChild;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get the last child
$last = $he->LastChild;NextSibling
Property
Gets the next element.
If the next element to a higher level, then return null.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get next element
HtmlElement next = he.NextSibling;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get next element
$next = $he->NextSibling;PreviousSibling
Property
Gets the previous element.
If the previous element to a higher level, then return null.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get previous element
HtmlElement prevElement = he.PreviousSibling;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get previous element
$prevElement = $he->PreviousSibling;OuterHtml
Property
Gets the dom text of the html element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get outer html
string domText = he.OuterHtml;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get outer html
$domText = $he->OuterHtml;InnerHtml
Property
Gets the html text inside the tag of the element.
Example
// find element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get inner html
string innerHtml = he.InnerHtml;Example2
// find element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get inner html
$innerHtml = $he->InnerHtml;InnerText
Property
Gets the text inside the tag of the element.
Example
// find element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get inner text
string innerText = he.InnerText;Example2
// find element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get inner text
$innerText = $he->InnerText;TagName
Property
Gets the tag of the element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get tag name
string tag = he.TagName;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get tag name
$tag = $he->TagName;FullTagName
Property
Gets the full tag of the element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get full tag name
string fullTagName = he.FullTagName;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get full tag name
$fullTagName = $he->FullTagName;Name
Property
Gets the name of the html element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get name
string name = he.Name;Example2
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get name
string name = he.Name;Id
Property
Gets the ID of the element
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get id
string id = he.Id;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get id
$id = $he->Id;Height
Property
Gets the height of the html element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get height
int height = he.Height;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get height
$height = $he->Height;Width
Property
Gets the width of the html element.
Example
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get width
int width = he.Width;Example2
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get width
$width = $he->Width;BoundingClientHeight
Property
Gets the bounding client height of the html element.
BoundingClientWidth
Property
Gets the bounding client width of the html element.
IsNull
Property
Gets a value that indicates whether or not the value of the html element is null value.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by attribute
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// if element is null then return -1
if (he.IsNull) return -1;
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by attribute
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// if element is null then return -1
if ($he->IsNull) return -1;
return 0;
}DisplacementInTabWindow
Property
Gets the displacement of the upper left corner relative to the tab’s window.
Example
using System.Drawing;
...
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get displacement in tab window
Point point = he.DisplacementInTabWindow;Example2
use System\Drawing;
...
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get displacement in tab window
$point = $he->DisplacementInTabWindow;DisplacementInDocument
Property
Gets the displacement of the upper left corner relative to the parent document.
This property displays the coordinates relative to the parent document. These coordinates are not always equal DisplacementInTabWindow.
Example
using System.Drawing;
...
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get displacement in document
Point point = he.DisplacementInDocument;Example2
use System\Drawing;
...
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get displacement in document
$point = $he->DisplacementInDocument;DisplacementInBrowser
Property
Gets the displacement of the upper left corner relative to the window top.
Example
using System.Drawing;
...
// find element
HtmlElement he = tab.GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get displacement in document
Point point = he.DisplacementInBrowser;Example2
use System\Drawing;
...
// find element
$he = $tab->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get displacement in document
$point = $he->DisplacementInBrowser;Methods
ScrollIntoView
Method
The performs scroll the tab to the current html element.
This method performs only the scrolling to the current html element. It may need when necessary change the view of the tab and for example perform click by coordinates inside the tab using the Tab class methods.
Example
// navigate to lessons.zennolab.com
instance.ActiveTab.Navigate("lessons.zennolab.com", "");
// wait downloading
instance.ActiveTab.WaitDownloading();
// try find the html element
HtmlElement he = instance.ActiveTab.MainDocument.FindElementByAttribute("textarea", "name", "text", "text", 0);
// if html element was found
if (!he.IsVoid)
{
// scroll view of tab to the html element
he.ScrollIntoView();
// performs the click inside tab by coordinates
instance.ActiveTab.MouseClick(he.DisplacementInTabWindow.X + 10, he.DisplacementInTabWindow.Y + 10, "left", "click");
// send the text
instance.SendText("It's just example. If you see this text then all work correctly. Don't forget to buy one more ZennoPoster.", 75);
}Example2
// navigate to lessons.zennolab.com
$instance->ActiveTab->Navigate("lessons.zennolab.com", "");
// wait downloading
$instance->ActiveTab->WaitDownloading();
// try find the html element
$he = $instance->ActiveTab->MainDocument->FindElementByAttribute("textarea", "name", "text", "text", 0);
// if html element was found
if (!$he->IsVoid)
{
// scroll view of tab to the html element
$he->ScrollIntoView();
// performs the click inside tab by coordinates
$instance->ActiveTab->MouseClick($he->DisplacementInTabWindow->X + 10, $he->DisplacementInTabWindow->Y + 10, "left", "click");
// send the text
$instance->SendText("It's just example. If you see this text then all work correctly. Don't forget to buy one more ZennoPoster.", 75);
}DragDrop
Method
Performs the drag and drop events for specified elements.
In case there is any coordinate is -1, will be used the central position of the element on specified axis.
Parameters
| Параметр | Описание |
|---|---|
element | The html element for drop event. |
dragX | The x coordinate inside element’s area for rise drag event. Default value is -1. |
dradY | The y coordinate inside element’s area for rise drag event. Default value is -1. |
dropX | The x coordinate inside element’s area for rise drop event. Default value is -1. |
dropY | The y coordinate inside element’s area for rise drop event. Default value is -1. |
Example
// find element fo drop event
HtmlElement dropHe = instance.ActiveTab.FindElementById("some_id");
// if element is exist
if (!dropHe.IsVoid)
{
// find element for drap event
HtmlElement dragHe = instance.ActiveTab.FindElementById("any_id");
// if element is exist
if (!dragHe.IsVoid)
{
// rise drag and drop events
// drop dropHe (rise event in position x = 10, y = 30) to the specified place (50, 50)
dragHe.DragDrop(dropHe, 10, 30, 50, 50);
}
}Example2
// find element fo drop event
$dropHe = $instance->ActiveTab->FindElementById("some_id");
// if element is exist
if (!$dropHe->IsVoid)
{
// find element for drap event
$dragHe = $instance->ActiveTab->FindElementById("any_id");
// if element is exist
if (!$dragHe->IsVoid)
{
// rise drag and drop events
// drop dropHe (rise event in position x = 10, y = 30) to the specified place (50, 50)
$dragHe->DragDrop($dropHe, 10, 30, 50, 50);
}
}DrawToBitmap
Method
Supports rendering to the bitmap.
If the html element has the tag “img” and the method’s parameter is true, then this method executes faster.
Parameters
| Параметр | Описание |
|---|---|
isImage | true if the tag of this of the element is “img”, otherwise, false. |
hash | The parameter use only in demo version. Default value is String.Empty. |
Returns: The image as a string value.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// draw to bitmap element, this element is not image and does not contain image
string toBitmap1 = he.DrawToBitmap(false);
// find element by attribute
he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw to bitmap element, this element is image or contains image
string toBitmap2 = he.DrawToBitmap(true);Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// draw to bitmap element, this element is not image and does not contain image
$toBitmap1 = $he->DrawToBitmap(false);
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw to bitmap element, this element is image or contains image
$toBitmap2 = $he->DrawToBitmap(true);DrawAsBitmap
Method
Supports rendering to the bitmap.
If the html element has the tag “img” and the method’s parameter is true, then this method executes faster.
Parameters
| Параметр | Описание |
|---|---|
isImage | true if the tag of this of the element is “img”, otherwise, false. |
hash | The parameter use only in demo version. Default value is String.Empty. |
Returns: The image as a bitmap.
Example
// find element by attribute
var he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// draw to bitmap element, this element is not image and does not contain image
var toBitmap1 = he.DrawAsBitmap(false);
// find element by attribute
he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw to bitmap element, this element is image or contains image
var toBitmap2 = he.DrawAsBitmap(true);Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// draw to bitmap element, this element is not image and does not contain image
$toBitmap1 = $he->DrawAsBitmap(false);
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw to bitmap element, this element is image or contains image
$toBitmap2 = $he->DrawAsBitmap(true);DrawPartToBitmap
Method
Supports rendering part of element to the bitmap.
If the html element has the tag “img” and the method’s parameter is true, then this method executes faster.
Parameters
| Параметр | Описание |
|---|---|
left | The distance, in pixels, between the left edge of the element and the left edge of its client area. |
top | The distance, in pixels, between the top edge of the element and the top edge of its client area. |
isImage | true if the tag of this of the element is “img”, otherwise, false. |
width | The width of the part. |
height | The height of the part. |
hash | The parameter use only in demo version. Default value is String.Empty. |
Returns: The part of image as a string value.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw part of bitmap to the string value
string toBitmap = he.DrawPartToBitmap(0, 0, 20, 20, true);Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw part of bitmap to the string value
$toBitmap = $he->DrawPartToBitmap(0, 0, 20, 20, true);DrawPartAsBitmap
Method
Supports rendering part of element to the bitmap.
If the html element has the tag “img” and the method’s parameter is true, then this method executes faster.
Parameters
| Параметр | Описание |
|---|---|
left | The distance, in pixels, between the left edge of the element and the left edge of its client area. |
top | The distance, in pixels, between the top edge of the element and the top edge of its client area. |
isImage | true if the tag of this of the element is “img”, otherwise, false. |
width | The width of the part. |
height | The height of the part. |
hash | The parameter use only in demo version. Default value is String.Empty. |
Returns: The part of image as a bitmap.
Example
// find element by attribute
var he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw part of bitmap to the string value
var toBitmap = he.DrawPartAsBitmap(0, 0, 20, 20, true);Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// draw part of bitmap to the string value
$toBitmap = $he->DrawPartAsBitmap(0, 0, 20, 20, true);FindChildByAttribute
Method
Searches for an element among the children by the attribute, and returns the first occurrence.
If html element was not found then this method returns the HtmlElement object in which IsVoid or IsNill property is “true”.
Parameters
| Параметр | Описание |
|---|---|
tags | Tags for search the element. If the count of tags is more than one then they are through ”;“. |
attrName | The attribute name. |
searchKind | This parameter can take the following values: “text”, “notext” and “regexp”. |
attrValue | The attribute value. |
number | The document address. |
Returns: The first element that matches the conditions defined by the attribute, if found; otherwise, the result is void.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find child element by attribute
HtmlElement heCh = he.FindChildByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find child element by attribute
$heCh = $he->FindChildByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
return 0;
}FindChildrenByAttribute
Method
Searches for all elements among the children by the attribute.
If html elements were not found then this method returns the HtmlElementCollection object in which IsVoid property is “true”.
Parameters
| Параметр | Описание |
|---|---|
tags | Tags for search the elements. If the count of tags is more than one then they are through ”;“. |
attrName | The attribute name. |
attrValue | The attribute value. |
searchKind | This parameter can take the following values: “text”, “notext” and “regexp”. |
Returns: The collection of elements that matches the conditions defined by the attribute, if found; otherwise, the Count property is “0”.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find all children by attribute
HtmlElementCollection heCol = he.FindChildrenByAttribute("input:checkbox", "fulltag", "input:checkbox", "text");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find all children by attribute
$heCol = $he->FindChildrenByAttribute("input:checkbox", "fulltag", "input:checkbox", "text");
return 0;
}FindChildById
Method
Searches for an element among the children by the ID, and returns the first occurrence.
If html element was not found then this method returns the HtmlElement object in which IsVoid or IsNill property is “true”.
Parameters
| Параметр | Описание |
|---|---|
id | The ID that defines search condition of HTML elements. |
Returns: The first element that matches the conditions defined by the ID, if found; otherwise, the result is void.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find child element by id
HtmlElement heCh = he.FindChildById("inputs");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find child element by id
$heCh = $he->FindChildById("inputs");
return 0;
}FindChildrenById
Method
Searches for all elements among the children by the ID.
If html elements were not found then this method returns the HtmlElementCollection object in which IsVoid property is “true”.
Parameters
| Параметр | Описание |
|---|---|
id | The ID that defines search condition of HTML elements. |
Returns: The collection of elements that matches the conditions defined by the ID, if found; otherwise, the Count property is “0”.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find all children by id
HtmlElementCollection heCol = he.FindChildrenById("inputs");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find all children by id
$heCol = $he->FindChildrenById("inputs");
return 0;
}FindChildByName
Method
Searches for an element among the children by the name, and returns the first occurrence.
If html element was not found then this method returns the HtmlElement object in which IsVoid or IsNill property is “true”.
Parameters
| Параметр | Описание |
|---|---|
name | The name that defines search condition of HTML elements. |
Returns: The first element that matches the conditions defined by the name, if found; otherwise, the result is void.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find child element by name
HtmlElement heCh = he.FindChildByName("text");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find child element by name
$heCh = $he->FindChildByName("text");
return 0;
}FindChildrenByName
Method
Searches for all elements among the children by the name.
If html elements were not found then this method returns the HtmlElementCollection object in which IsVoid property is “true”.
Parameters
| Параметр | Описание |
|---|---|
name | The name that defines search condition of HTML elements. |
Returns: The collection of elements that matches the conditions defined by the name, if found; otherwise, the Count property is “0”.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find all children by name
HtmlElementCollection heCol = he.FindChildrenByName("text");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find all children by name
$heCol = $he->FindChildrenByName("text");
return 0;
}FindChildByTag
Method
Searches for an element among the children by the tag, and returns the first occurrence.
If html element was not found then this method returns the HtmlElement object in which IsVoid or IsNill property is “true”.
Parameters
| Параметр | Описание |
|---|---|
tag | Tag for search the element. |
number | The document address. |
Returns: The first element that matches the conditions defined by the tag, if found; otherwise, the result is void.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find child element by tag
HtmlElement heCh = he.FindChildByTag("input:checkbox", 0);
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find child element by tag
$heCh = $he->FindChildByTag("input:checkbox", 0);
return 0;
}FindChildrenByTags
Method
Searches for all elements among the children by the tags.
If html elements were not found then this method returns the HtmlElementCollection object in which IsVoid property is “true”.
Parameters
| Параметр | Описание |
|---|---|
tags | Tags for search the elements. If the count of tags is more than one then they are through ”;“. |
Returns: The collection of elements that matches the conditions defined by the tags, if found; otherwise, the Count property is “0”.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find all children by tag
HtmlElementCollection heCol = he.FindChildrenByTags("input:checkbox");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find all children by tag
$heCol = $he->FindChildrenByTags("input:checkbox");
return 0;
}FindChildByXPath
Method
Searches for an element among the children by the xpath.
If html element was not found then this method returns the HtmlElement object in which IsVoid or IsNill property is “true”.
Parameters
| Параметр | Описание |
|---|---|
xpath | XPath for search the element. |
number | The document address. |
Returns: The first element that matches the conditions defined by the tag, if found; otherwise, the result is void.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
if (he.IsVoid) return -2;
// find child element by xpath
HtmlElement heCh = he.FindChildByXPath("div[@id]", 0);
if (heCh.IsVoid) return -3;
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
if ($he->IsVoid) return -2;
// find child element by xpath
$heCh = $he->FindChildByXPath("div[@id]", 0);
if ($heCh->IsVoid) return -3;
return 0;
}FindChildrenByXPath
Method
Searches for all elements among the children by the xpath.
If html elements were not found then this method returns the HtmlElementCollection object in which IsVoid property is “true”.
Parameters
| Параметр | Описание |
|---|---|
xpath | XPath for search the elements. |
Returns: The collection of elements that matches the conditions defined by the tags, if found; otherwise, the Count property is “0”.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find all children by xpath
HtmlElementCollection heCol = he.FindChildrenByXPath("div[@id]");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find all children by xpath
$heCol = $he->FindChildrenByXPath("div[@id]");
return 0;
}GetChildren
Method
Returns the all children.
Parameters
| Параметр | Описание |
|---|---|
recursive | true to returns all children of the element; otherwise, false, returns the children of the first level. |
Returns: A collection that contains all children of the html element.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get all children of current html element
HtmlElementCollection heCol = he.GetChildren(true);Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get all children of current html element
$heCol = $he->GetChildren(true);RemoveChild
Method
Removes a first level child element.
The IsNull property be true if the html element does not belongs to any document.
Parameters
| Параметр | Описание |
|---|---|
child | The first level child element to remove. |
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by id
HtmlElement he = tab.FindElementById("main");
// find element for remove
HtmlElement heToRemove = tab.FindElementById("inputs");
// remove child element
he.RemoveChild(heToRemove);
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by id
$he = $tab->FindElementById("main");
// find element for remove
$heToRemove = $tab->FindElementById("inputs");
// remove child element
$he->RemoveChild($heToRemove);
return 0;
}InsertElementBefore
Method
Inserts the specified element before this element.
Parameters
| Параметр | Описание |
|---|---|
insertingElement | The html element to insert. The value can be null. |
Example
// find first element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// find second element
HtmlElement hePrev = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("rad");
// insert element "hePrev" before "he"
he.InsertElementBefore(hePrev);Example2
// find first element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// find second element
$hePrev = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("rad");
// insert element "hePrev" before "he"
$he->InsertElementBefore($hePrev);InsertElementAfter
Method
Inserts the specified element after this element.
Parameters
| Параметр | Описание |
|---|---|
insertingElement | The html element to insert. The value can be null. |
Example
// find first element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// find second element
HtmlElement heNext = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("rad");
// insert element "heNext" after "he"
he.InsertElementAfter(heNext);Example2
// find first element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// find second element
$heNext = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("rad");
// insert element "heNext" after "he"
$he->InsertElementAfter($heNext);SetAttribute
Method
Sets the text of attribute.
Parameters
| Параметр | Описание |
|---|---|
attrName | The attribute name. |
attrValue | The new value for this attribute. |
Example
// find element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// set attribute
he.SetAttribute("Name", "NewTextValue");Example2
// find element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// set attribute
$he->SetAttribute("Name", "NewTextValue");GetAttribute
Method
Returns the text of attribute.
Parameters
| Параметр | Описание |
|---|---|
attrName | The name of attribute. |
Returns: The text of attribute.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get attribute value
string attributeText = he.GetAttribute("TagName");Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get attribute value
$attributeText = $he->GetAttribute("TagName");GetStylePropertyValue
Method
Returns the text of style property.
Parameters
| Параметр | Описание |
|---|---|
property | The name of style property. |
Returns: The text of style property.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get attribute value
string propertyText = he.GetStylePropertyValue("display");
// propertyText = "inline-block"Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get attribute value
$propertyText = $he->GetStylePropertyValue("display");
// $propertyText = "inline-block"RemoveAttribute
Method
Removes the specified attribute.
Parameters
| Параметр | Описание |
|---|---|
attrName | The name of the attribute. |
RiseEvent
Method
The performs the specified event for html element.
The emulation levels: “Full” - the full emulation which include the generation of all events such as mouseover, mousemove, mouseout, focus on element and other.”Middle” - the standard emulation level includes a minimum of actions without additional events.”None” - the default emulation level without additional events and actions.
Parameters
| Параметр | Описание |
|---|---|
eventName | The name of the event. |
emulation | The emulation level. Can be: “None”, “Middle”, “Full” or “SuperEmulation”. |
Example
// find element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// rise event
he.RiseEvent("onclick", "full");Example2
// find element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// rise event
$he->RiseEvent("onclick", "full");ReplaceChild
Method
Replaces the specified child element.
Parameters
| Параметр | Описание |
|---|---|
newChild | The new child element. |
oldChild | The old child element. |
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element
HtmlElement he = tab.FindElementById("main");
// find first element
HtmlElement heOld = tab.FindElementById("inputs");
// find second element
HtmlElement heNew = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// replace element "heOld" to "heNew"
he.ReplaceChild(heNew, heOld);
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element
$he = $tab->FindElementById("main");
// find first element
$heOld = $tab->FindElementById("inputs");
// find second element
$heNew = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("a", "href", "http://lessons.zennolab.com/ru/index", "regexp", 0);
// replace element "heOld" to "heNew"
$he->ReplaceChild($heNew, $heOld);
return 0;
}GetValue
Method
Returns the value of the html element.
Parameters
| Параметр | Описание |
|---|---|
useSelectedItems | true for getting value using selected items; otherwise, false. |
Returns: The element value for the html element.
Example
// find html element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get value
string heValue = he.GetValue(false);Example2
// find html element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// get value
$heValue = $he->GetValue(false);SetValue
Method
Sets the value of the html element.
Parameters
| Параметр | Описание |
|---|---|
value | The new value for this html element. |
emulation | The emulation level. May be: “None”, “Middle”, “Full” or “SuperEmulation”. |
useSelectedItems | true if you need use automatic filling standard “select” fields; otherwise false. |
append | true if you need append value to an existing content; otherwise false. |
Example
// find element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// set value
he.SetValue("true", "Middle", true);Example2
// find element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// set value
$he->SetValue("true", "Middle", true);GetSelectedItems
Method
Returns the value of the selected items.
Returns: The value of the selected items recorded through ”;“.
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element by name
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("lang[]");
if (he.IsVoid) return -1;
// set value
he.SetValue("1;2;3", true);
// get selected items in string format
string selectedItems = he.GetSelectedItems();
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element by name
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("lang[]");
if ($he->IsVoid) return -1;
// set value
$he->SetValue("1;2;3", true);
// get selected items in string format
$selectedItems = $he->GetSelectedItems();
return 0;
}SetSelectedItems
Method
Sets the value of the selected items.
Parameters
| Параметр | Описание |
|---|---|
value | The value of the selected items recorded through ”;“. |
Example
public static int Execute(Instance instance, IZennoPosterProjectModel project)
{
// clear cookie
instance.ClearCookie();
// go to lessons.zennolab.com
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();
// find element
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByName("anything[]");
// set selected item
he.SetSelectedItems("16-30");
return 0;
}Example2
public static function Execute($instance, $project)
{
// clear cookie
$instance->ClearCookie();
// go to lessons.zennolab.com
$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();
// find element
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByName("anything[]");
// set selected item
$he->SetSelectedItems("16-30");
return 0;
}Focus
Method
Sets input focus to the html element.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// focus on this element
he.Focus();Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// focus on this element
$he->Focus();Click
Method
The performs the click event on the html element.
This method performs the click event with default settings. For setting the event settings use the RiseEvent method.
Example
// find element by attribute
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// click on the element
he.Click();Example2
// find element by attribute
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByAttribute("input:checkbox", "fulltag", "input:checkbox", "text", 0);
// click on the element
$he->Click();Reload
Method
Reloads the html element.
This method performs the reload the html element.
Example
// find flash objects
var flashObjects = instance.ActiveTab.FindElementsByTags("embed;object");
if (flashObjects == null) return -1;
// set wmode = opaque every element which has incorrect value of property "wmode"
for (int i = 0; i < flashObjects.Count; i++)
{
var flashObjectsNew = instance.ActiveTab.FindElementsByTags("embed;object");
var element = flashObjectsNew.GetByNumber(i);
var children = element.FindChildrenByName("wmode");
if (children != null && children.Count != 0) {
for (int j = 0; j < children.Count; j++)
{
var child = children.GetByNumber(j);
if (child.ParentElement.ZP_ID != element.ZP_ID)
continue;
if (child.TagName.ToLower().Equals("param"))
{
var wmode = child.GetAttribute("value");
if (wmode != null && (!wmode.ToLower().Equals("opaque") && !wmode.ToLower().Equals("transparent")))
{
child.SetAttribute("value", "opaque");
element.Reload();
}
}
}
}
else
{
var wmode = element.GetAttribute("wmode");
if (!(wmode != null && (wmode.ToLower().Equals("opaque") || wmode.ToLower().Equals("transparent"))))
{
element.SetAttribute("wmode", "opaque");
element.Reload();
}
}
}Example2
// find flash objects
$flashObjects = $instance->ActiveTab->FindElementsByTags("embed;object");
if ($flashObjects == null) return -1;
// set wmode = opaque every element which has incorrect value of property "wmode"
for ($i = 0; $i < $flashObjects->Count; i++)
{
$flashObjectsNew = $instance->ActiveTab->FindElementsByTags("embed;object");
$element = $flashObjectsNew->GetByNumber($i);
$children = $element->FindChildrenByName("wmode");
if ($children != null && $children->Count != 0) {
for ($j = 0; $j < $children->Count; j++)
{
$child = $children->GetByNumber($j);
if ($child->ParentElement->ZP_ID != $element->ZP_ID)
continue;
if ($child->TagName->ToLower()->Equals("param"))
{
$wmode = $child->GetAttribute("value");
if ($wmode != null && (!$wmode->ToLower()->Equals("opaque") && !$wmode->ToLower()->Equals("transparent")))
{
$child->SetAttribute("value", "opaque");
$element->Reload();
}
}
}
}
else
{
$wmode = $element->GetAttribute("wmode");
if (!($wmode != null && ($wmode->ToLower()->Equals("opaque") || $wmode->ToLower()->Equals("transparent"))))
{
$element->SetAttribute("wmode", "opaque");
$element->Reload();
}
}
}DropFile
Method
Drop file to the element.
Parameters
| Параметр | Описание |
|---|---|
filepath | The path to file. |
x | The x coordinate inside element’s area for rise drag event. Default value is -1. |
y | The y coordinate inside element’s area for rise drag event. Default value is -1. |
GetNull
Method
Возвращает пустой элемент