IZennoPosterProjectModel

Assembly: ZennoLab.InterfacesLibrary
Full name: ZennoLab.InterfacesLibrary.ProjectModel.IZennoPosterProjectModel


Represents a model of current project. Performs access to global variables, local variables, tables, profile, lists. Contains methods for sending messages of warnings and errors to program’s log.

The object of the IZennoPosterModel interface get access to major data of ZennoPoster’s project.

Properties

Directory

Property

Gets the directory of the project file.

Example

// get directory of the project
            string projectDirectory = project.Directory;

Example2

// get directory of the project
            $projectDirectory = $project->Directory;

Path

Property

Gets the directory of the project file with terminating.

Example

// get directory of the project
            string projectDirectory = project.Path;

Example2

// get directory of the project
            $projectDirectory = $project->Path;

Variables

Property

Get a collection of local variables that can be accessed name.

Example

// get local variable
            ILocalVariable lv = project.Variables["MyLocalVariable"];
             
            // set value
            if (lv.Value == "5") lv.Value = "0";

Example2

// get local variable
            $lv = $project->Variables->get_Item("MyLocalVariable");
             
            // set value
            if ($lv->Value == "5") $lv->Value = "0";

GlobalVariables

Property

Get a collection of global variables that can be accessed by namespace and name.

Example

// get global variable by namespace and name
            // variable "gv" object of interface IGlobalVariable
            IGlobalVariable gv = project.GlobalVariables["MyNamespase", "VariableName"];
             
            // change value of global variable
            gv.Value = "ChangedValue";
             
            // create a new global variable and set value
            project.GlobalVariables.SetVariable("MyNamespase", "NewVariableName", "NewValue");

Example2

// get global variable by namespace and name
            // variable "gv" object of interface IGlobalVariable
            $gv = $project->GlobalVariables->get_Item("MyNamespase", "VariableName");
             
            // change value of global variable
            $gv->Value = "ChangedValue";
             
            // create a new global variable and set value
            $project->GlobalVariables->SetVariable("MyNamespase", "NewVariableName", "NewValue");

Lists

Property

Get a collection of lists that can be accessed name.

Example

// get list by name "MyList"
            var list = project.Lists["MyList"];
             
            // add a new item to list
            list.Add("new_list_item");
             
            // get list by name "AnotherList" and get count of item
            int count = project.Lists["AnotherList"].Count;

Example2

// get list by name "MyList"
            $list = $project->Lists->get_Item("MyList");
             
            // add a new item to list
            $list->Add("new_list_item");
             
            // get list by name "AnotherList" and get count of item
            $count = $project->Lists->get_Item("AnotherList")->Count;

Name

Property

Gets the name of the project.

Example

// get the name of the current project
            string projectName = project.Name;

Example2

// get the name of the current project
            $projectName = $project->Name;

Tables

Property

Get a collection of tables that can be accessed name.

Example

// get table by name "MyTable"
            IZennoTable table = project.Tables["MyTable"];
             
            // add a new row
            table.AddRow("simple text");
             
            // get table by name "AnotherTable" and get row count
            int count = project.Tables["AnoterTable"].RowCount;

Example2

// get table by name "MyTable"
            $table = $project->Tables->get_Item("MyTable");
             
            // add a new row
            $table->AddRow("simple text");
             
            // get table by name "AnotherTable" and get row count
            $count = $project->Tables->get_Item("AnoterTable")->RowCount;

GoogleSpreadsheets

Property

Get a collection of Google spreadsheets that can be accessed name.

Profile

Property

Get a profile of current project.

Example

// set a new email to profile
            project.Profile.Email = "myemail@someemail.com";
             
            // get SecretQuestionAnswer1 from profile
            string SecretQuestionAnswer1 = project.Profile.SecretQuestionAnswer1;

Example2

// set a new email to profile
            $project->Profile->Email = "myemail@someemail.com";
             
            // get SecretQuestionAnswer1 from profile
            $SecretQuestionAnswer1 = $project->Profile->SecretQuestionAnswer1;

ProxyRules

Property

Gets the proxy rules for the current project.

Example

// get the proxy rules of the current project
            string proxyRules = project.ProxyRules;

Example2

// get the proxy rules of the current project
            $proxyRules = $project->ProxyRules;

Context

Property

Gets a context of the current project.

Example

// get shared object with name "ObjectName"
            object o = project.Context["ObjectName"];
            // set shared object with name "ObjectName"
            project.Context["ObjectName"] = "example string or any another object";

TaskId

Property

Gets the id of the task.

Example

// get the id of the current task
            String id = project.TaskId;

Example2

// get the id of the current task
            $id = $project->TaskId;

LogOptions

Property

Gets the options of the execution log of the project.

Example

// get the path to log file
            string path = project.LogOptions.LogFile;
            // set the path to log file
            project.LogOptions.LogFile = "X:\\log.txt";
            // enable splitting for log
            project.LogOptions.SplitLogByThread = true; 
            return tmp;

LastExecutedActionId

Property

Get an information about last executed action ID.

Example

string id = project.LastExecutedActionId;
            return id;

Example2

$id = $project->LastExecutedActionId;
            return $id;

LastExecutedActionElapsedTime

Property

Get an information about last executed action elapsed time (ms).

Example

var timeMs = project.LastExecutedActionElapsedTime;
            return timeMs;

Example2

$timeMs = $project->LastExecutedActionElapsedTime;
            return $timeMs;

Json

Property

Get dynamic object for Json.

Example

project.Json.FromString("{\"Status\": 200}");
            return project.Json.Status;

Example2

$project->Json->FromString("{\"Status\": 200}");
            return $project->Json->Status;

Xml

Property

Get dynamic object for Xml.

Example

project.Xml.FromString("<Answer><Status>200</Status></Answer>");
            return project.Xml.Answer.Status;

Example2

$project->Xml->FromString("<Answer><Status>200</Status></Answer>");
            return $project->Xml->Answer->Status;

Environment

Property

Gets information of the current envirovment.

PluginDirectory

Property

Gets the directory of the plugin file.

Example

// get directory of the plugin
            string pluginDirectory = project.PluginDirectory;

Example2

// get directory of the project
            $pluginDirectory = $project->PluginDirectory;

PluginPath

Property

Gets the path of the plugin file with terminating.

Example

// get path of the plugin
            string pluginPath = project.PluginPath;

Example2

// get path  of the plugin
            $pluginPath = $project->PluginPath;

LastErrorComment

Property

Get a message from last unsuccessful action.

Returns: A message from last unsuccessful action.

BrowserProfileFolder

Property

Get path to folder-profile of currently running browser instance. Empty string if folder-profile is not used.

Returns: Path to folder-profile of currently running browser instance. Empty string if folder-profile is not used.

ZennoBrowserProfileId

Property

Get the ProfileId of the current ZennoBrowser profile we are interested in.

Returns: Get the ProfileId of the current ZennoBrowser profile we are interested in.

ZennoBrowserProfileContainerId

Property

Get the ProfileContainerId of the current ZennoBrowser profile folder we are interested in.

Returns: Get the ProfileContainerId of the current ZennoBrowser profile folder we are interested in.

Methods

GetProxy

Method

Gets the proxy for the current project.

Example

// get the proxy of the current project
            string proxy = project.GetProxy();

Example2

// get the proxy of the current project
            $proxyRules = $project->GetProxy();

SetProxy

Method

Sets the proxy for the current project.

Example

// set the proxy of the current project
            project.SetProxy(proxy);

Example2

// set the proxy of the current project
            $project->SetProxy($proxy);

SendToLog

Method

Send a message to the log of ZennoPoster.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A message for send.
typeType of message to be displayed in the log

Example

// get gender form profile
                     ProfileSex gender = project.Profile.Sex;
                      
                     // send warning
                     if (gender == ProfileSex.Female) project.SendToLog("Oh, hell, it is a woman", ZennoLab.InterfacesLibrary.Enums.Log.LogType.Warning);

Example2

// get gender form profile
                     $gender = $project->Profile->Sex;
                      
                     // send warning
                     if ($gender == ProfileSex::Female) $project->SendWarningToLog("Oh, hell, it is a woman", ZennoLab::InterfacesLibrary::Enums::Log::LogType->Warning);

SendToLog

Method

Send a message to the log of ZennoPoster.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A message for send.
typeType of message to be displayed in the log
showInPosterSet true, if needs show this message in ZennoPoster.

Example

// get gender form profile
                     ProfileSex gender = project.Profile.Sex;
                      
                     // send warning
                     if (gender == ProfileSex.Female) project.SendToLog("Oh, hell, it is a woman", ZennoLab.InterfacesLibrary.Enums.Log.LogType.Warning, false);

Example2

// get gender form profile
                     $gender = $project->Profile->Sex;
                      
                     // send warning
                     if ($gender == ProfileSex::Female) $project->SendWarningToLog("Oh, hell, it is a woman", ZennoLab::InterfacesLibrary::Enums::Log::LogType->Warning, FALSE);

SendToLog

Method

Send a message to the log of ZennoPoster.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A message for send.
typeType of message to be displayed in the log
showInPosterSet true, if needs show this message in ZennoPoster.
colorThe background color of a message

Example

// get gender form profile
                              ProfileSex gender = project.Profile.Sex;
                               
                              // send warning
                              if (gender == ProfileSex.Female)
            				      project.SendToLog("Oh, hell, it is a woman",
            					      ZennoLab.InterfacesLibrary.Enums.Log.LogType.Warning,
            						  false,
            						  ZennoLab.InterfacesLibrary.Enums.Log.LogColor.Yellow);

Example2

// get gender form profile
                              $gender = $project->Profile->Sex;
                               
                              // send warning
                              if ($gender == ProfileSex::Female)
            				      $project->SendWarningToLog("Oh, hell, it is a woman",
            					      ZennoLab::InterfacesLibrary::Enums::Log::LogType->Warning,
            						  FALSE,
            						  ZennoLab::InterfacesLibrary::Enums::Log::LogColor->Yellow);

SendToLog

Method

Send a message to the log of ZennoPoster.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A message for send.
wayAn error “way” for send. The parameter “way” can be line in code, action ID or module.
typeType of message to be displayed in the log

Example

// get gender form profile
                              ProfileSex gender = project.Profile.Sex;
                               
                              // send warning
                              if (gender == ProfileSex.Female) project.SendToLog("Oh, hell, it is a woman", "Own Code C#", ZennoLab.InterfacesLibrary.Enums.Log.LogType.Warning);

Example2

// get gender form profile
                              $gender = $project->Profile->Sex;
                               
                              // send warning
                              if ($gender == ProfileSex::Female) $project->SendWarningToLog("Oh, hell, it is a woman", "Own Code PHP", ZennoLab::InterfacesLibrary::Enums::Log::LogType->Warning);

SendToLog

Method

Send a message to the log of ZennoPoster.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A message for send.
wayAn error “way” for send. The parameter “way” can be line in code, action ID or module.
typeType of message to be displayed in the log
showInPosterSet true, if needs show this message in ZennoPoster.

Example

// get gender form profile
                              ProfileSex gender = project.Profile.Sex;
                               
                              // send warning
                              if (gender == ProfileSex.Female) project.SendToLog("Oh, hell, it is a woman", "Own Code C#", ZennoLab.InterfacesLibrary.Enums.Log.LogType.Warning, true);

Example2

// get gender form profile
                              $gender = $project->Profile->Sex;
                               
                              // send warning
                              if ($gender == ProfileSex::Female) $project->SendWarningToLog("Oh, hell, it is a woman", "Own Code PHP", ZennoLab::InterfacesLibrary::Enums::Log::LogType->Warning, TRUE);

SendToLog

Method

Send a message to the log of ZennoPoster.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A message for send.
wayAn error “way” for send. The parameter “way” can be line in code, action ID or module.
typeType of message to be displayed in the log
showInPosterSet true, if needs show this message in ZennoPoster.
colorThe background color of a message

Example

// get gender form profile
                              ProfileSex gender = project.Profile.Sex;
                               
                              // send warning
                              if (gender == ProfileSex.Female)
            				      project.SendToLog("Oh, hell, it is a woman",
            					      "Own Code C#",
            						  ZennoLab.InterfacesLibrary.Enums.Log.LogType.Warning,
            						  true,
            						  ZennoLab.InterfacesLibrary.Enums.Log.LogColor.Orange);

Example2

// get gender form profile
                              $gender = $project->Profile->Sex;
                               
                              // send warning
                              if ($gender == ProfileSex::Female)
            				      $project->SendWarningToLog("Oh, hell, it is a woman",
            					      "Own Code PHP",
            					      ZennoLab::InterfacesLibrary::Enums::Log::LogType->Warning,
            					      TRUE,
            					      ZennoLab::InterfacesLibrary::Enums::Log::LogColor->Orange);

SendWarningToLog

Method

Send a warning message to the log of ZennoPoster.

The parameter “way” hasn’t restrictions, it should use for specify the location where warning was detected. This parameter can be empty.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A warning message for send.
showInPosterSet true, if needs show this message in ZennoPoster.

Example

// get gender form profile
            ProfileSex gender = project.Profile.Sex;
             
            // send warning
            if (gender == ProfileSex.Female) project.SendWarningToLog("Oh, hell, it is a woman", "OwnCode C#");

Example2

// get gender form profile
            $gender = $project->Profile->Sex;
             
            // send warning
            if ($gender == ProfileSex::Female) $project->SendWarningToLog("Oh, hell, it is a woman", "OwnCode PHP");

SendErrorToLog

Method

Send an error message to the log of ZennoPoster.

The parameter “way” hasn’t restrictions, it should use for specify the location where error was detected. This parameter can be empty.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx An error message for send.
showInPosterSet true, if needs show this message in ZennoPoster.

Example

try
            {
                // get global variable
                IGlobalVariable gv = project.GlobalVariables["MyNamespace", "MyGlobalVariable"];
            }
            catch (Exception e)
            {
                // send error to log
                project.SendErrorToLog(e.Message);
            }

Example2

try
            {
                // get global variable
                $gv = $project->GlobalVariables->get_Item("MyNamespace", "MyGlobalVariable");
            }
            catch (Exception $e)
            {
                // send error to log
                $project->SendErrorToLog($e->Message);
            }

SendInfoToLog

Method

Send an information to the log of ZennoPoster.

Parameters

ПараметрОписание
messageAn information for send.
showInPosterSet true, if needs show this message in ZennoPoster.

Example

// get gender form profile
            ProfileSex gender = project.Profile.Sex;
             
            // send warning
            if (gender == ProfileSex.Female) project.SendInfoToLog("It is a woman");

Example2

// get gender form profile
            $gender = $project->Profile->Sex;
             
            // send warning
            if ($gender == ProfileSex::Female) $project->SendInfoToLog("It is a woman");

SendWarningToLog

Method

Send a warning message to the log of ZennoPoster.

The parameter “way” hasn’t restrictions, it should use for specify the location where warning was detected. This parameter can be empty.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx A warning message for send.
way:http://msdn.microsoft.com/en-us/library/system.string.aspx A warning “way” for send. The parameter “way” can be line in code, action or module.
showInPosterSet true, if needs show this message in ZennoPoster.

Example

// get gender form profile
            ProfileSex gender = project.Profile.Sex;
             
            // send warning
            if (gender == ProfileSex.Female) project.SendWarningToLog("Oh, hell, it is a woman", "OwnCode C#");

Example2

// get gender form profile
            $gender = $project->Profile->Sex;
             
            // send warning
            if ($gender == ProfileSex::Female) $project->SendWarningToLog("Oh, hell, it is a woman", "OwnCode PHP");

SendErrorToLog

Method

Send an error message to the log of ZennoPoster.

The parameter “way” hasn’t restrictions, it should use for specify the location where error was detected. This parameter can be empty.

Parameters

ПараметрОписание
message:http://msdn.microsoft.com/en-us/library/system.string.aspx An error message for send.
wayAn error “way” for send. The parameter “way” can be line in code, action ID or module.
showInPosterSet true, if needs show this message in ZennoPoster.

Example

try
            {
                // get global variable
                IGlobalVariable gv = project.GlobalVariables["MyNamespace", "MyGlobalVariable"];
            }
            catch (Exception e)
            {
                // send error to log
                project.SendErrorToLog(e.Message, "first action OwnCode C#");
            }

Example2

try
            {
                // get global variable
                $gv = $project->GlobalVariables->get_Item("MyNamespace", "MyGlobalVariable");
            }
            catch (Exception $e)
            {
                // send error to log
                $project->SendErrorToLog($e->Message, "first action OwnCode PHP");
            }

SendInfoToLog

Method

Send an information to the log of ZennoPoster.

Parameters

ПараметрОписание
messageAn information for send.
showInPosterSet true, if needs show this message in ZennoPoster.
wayAn information “way” for send. The parameter “way” can be line in code, action ID or module.

Example

// get gender form profile
            ProfileSex gender = project.Profile.Sex;
             
            // send warning
            if (gender == ProfileSex.Female) project.SendInfoToLog("It is a woman", "OwnCode C#");

Example2

// get gender form profile
            $gender = $project->Profile->Sex;
             
            // send warning
            if ($gender == ProfileSex::Female) $project->SendInfoToLog("It is a woman", "OwnCode PHP");

GetLastError

Method

Get a last error after project failed.

Returns: An information of last error.

Example

var error = project.GetLastError();
            var tmp = "";
            if(error != null)
                tmp = string.Format("ActionComment: {0}.\r\nActionGroupId: {1}.\r\nActionId: {2}", error.ActionComment, error.ActionGroupId, error.ActionId);
             
            return tmp;

ExecuteProject

Method

Execute ZennoPoster project.

Parameters

ПараметрОписание
pathToProjectThe path to project file.
varibleMappingCollection of pair variables name in current project and called project.
mapOnBadExistSet true, if needs map variables to current project even if execution of called project will be failed.
passProjectContextSet true, if needs map context of current project to called project and back.
useBrowserSet true, if needs to use browser.

Example

// set value for variable a1, make sure that source project contains variable "a1"
            project.Variables["a1"].Value = "example";
            var mapVars = new List<Tuple<string, string>>();
            // make sure that called project contains variable "b1"
            mapVars.Add(new Tuple<string, string>("a1", "b1"));
            return project.ExecuteProject("example.xmlz", mapVars, true, true, true);

ExecuteMacro

Method

Executes macroses in text and returns result.

Parameters

ПараметрОписание
textText with macroses.

Returns: Text with executed macroses.