Description of all 16 classes and 148 methods (4600 line of source code with comments
Every class & method has brief description of how to use it. You can find all method’s parameters description as well in the library code.
Droid
Класс Droid – This class is used for initializing the library and for writing code of your projects.
Droid.Droid – class constructor.
Droid.ReInit – re- initializing for repeatable iterations (you can set amount of iterations here instead of zennoposter).
Droid.Worker – code of your projects (you can use it instead zenno actions).
For initializing the library in a zenno action:
DLibEng.Droid droid = new DLibEng.Droid(project, instance);
If you wanna to call the lib’s methods from other actions you can use a static singleton registry pattern or just use context vars:
project.Context["droid"] = droid;
For example you can call a method using context vars:
project.Context["droid"].Http.GetSimple("
http://localhost/");
Browser
Класс Browser – methods to use a browser and its settings.
Browser.Browser – class constructor.
Browser.Tunes – 31 browser settings (plus cache, cookies, proxy, emulation level, etc).
Browser.Proxy – gets a proxy from a file by a thread number (script doesn’t delete strings in a file), sets the selected proxy and checks its state (with exception handling and logging).
Browser.WebRTC – sets web rtc, audio and video devices (to prevent real ip leaking)
Browser.Wait – waits for page loading.
Browser.Navigate – navigates to an url (you can set a refer and a tab), checks state of a tab, its loading status and a final url (was navigations successful or not), with exception handling and logging.
You can use this class to write clean & simple code, for example, if you wanna to navigate to a url, you need just one method call (all settings, verifications, exception handling and logging are included):
Browser.Navigate("https://mail.ru/");
Profiles
Класс Profiles – to create & use trusted profiles with history of websites visits.
Profiles.Profiles – class constructor.
Profiles.CreateOrLoad – selects profile number, checks if it exists or need to generate a new one.
Profiles.GetData – generates profile data.
Profiles.SaveFull – saves full profile
.
Profiles.SaveStr – private method (provides class functionality), saves profile data to a text.
Profiles.LoadFull – private method (provides class functionality), loads full profile.
Profiles.LoadStr – private method (provides class functionality), loads profile data from a text file.
Profiles.GetPathProfile – private method (provides class functionality), gets profile path
Profiles.GenerateLogin – private method (provides class functionality), generates login.
Profiles.GeneratePass – private method (provides class functionality), generates pass.
You can use this class in case you need some trusted profiles with history of websites visits. You can use these profiles for other projects later.
A simple method call:
Profiles.SaveFull();
Mouse
Класс Mouse – mouse emulation (mouse over, click, move, scroll based on human behavior).
Mouse.Mouse – class constructor.
Mouse.FindCoordsForMouseMove – finds element’s coordinates for mouse move & scroll.
Mouse.RiseEvent – a simple event.
Mouse.Click – the main method includes finding coordinates, scrolling a page, moving a mouse pointer over an element and click (you can choose one of 4 emulation levels).
Mouse.Move – moves a mouse pointer (you can choose one of 4 emulation levels).
Mouse.Scroll – scrolls a page (you need to turn on zenno FullEmulation and choose #3 or #4 library emulation level)
Mouse.MoveLikeHumanInViewport – mouse moves based on human behavior
Mouse.MoveWithRandomScroll – private method (provides class functionality) scrolls a page in few iterations with random timeouts and mouse moves.
Mouse.MoveWithRandomScrollRange – private method (provides class functionality) moves a mouse pointer and scrolls a page in a selected range of coordinates.
Mouse.MoveWithRandomScrollOverElement – private method (provides class functionality) moves a mouse pointer over an element after scrolling a page.
Mouse.MoveBezier – private method (provides class functionality) moves a mouse pointer using Bezier curves.
Mouse.DrawBezierX – private method (provides class functionality) creates Bezier curves.
Mouse.DrawBezierY – private method (provides class functionality) creates Bezier curves.
Mouse.DrawBezier – private method (provides class functionality) creates Bezier curves.
The most commonly used method is “Click”:.
1st emulation level. Instant scroll and JS click.
2st emulation level. A mouse pointer moves to an element with maximum speed and a click event rises.
3st emulation level. Step 1 - the script finds coordinates of an element. Step 2 – a mouse pointer moves in viewport emulating human behavior, just like you are moving your mouse while reading some text on a page. Step 3 – a simple scroll to an element. Step 4 – mouse over an element. Step 5 – full emulation click.
4st emulation level. Steps 1-2 are the same as above. Step 3 – the script scrolls a page step by step with random timeouts and mouse moves between every scroll, just like on step 2. So it looks like an user wanna read some texts on a page and are looking for something. Step 4 – the script moves a mouse pointer over an element, just like an user finally got what he looked for. Step 5 – full emulation click.
You can set up an emulation level in the library settings (class Registry).
To make a click on an element you need just one string of code:
Mouse.Click(element);
Txt
Класс Txt – working with text.
Txt.
Txt – class constructor.
Txt.Transliterate – cyrillic transliteration.
Txt.RegexMatch – returns a substring based on regular expression
Txt.SubBy – splits a string to a list using a separator.
Txt.SendWithRandDelay – fills in a text field with random delays between entering symbols (human behavior emulation)
Txt.SendClearField – clears a text field (deletes text).
Txt.Send – fills in a text field (4 emulation levels).
The most commonly used method is “Send”:
1st emulation level. Insert a value.
2st emulation level. Use a clipboard. DO NOT use this method in multithread projects!
3st emulation level. Fixed delay between entering symbols into a text field
4st emulation level. Fills in a text field with random delays between entering symbols (human behavior emulation). SendWithRandDelay method is called.
You can set up an emulation level in the library settings (class Registry).
To fill in a text field you need just one string of code:
Txt.Send(element, “text”);
Captcha
Класс Captcha – captcha solving using services api (default is (другой софт)). Pls be advised, that access to (другой софт) API DOES NOT INLUDED IN THIS LIBRARY. You need to buy access to (другой софт) Api separately.
Captcha.
Captcha – class constructor.
Captcha.XevilBalance – test connection to (другой софт) api.
Captcha.XevilReV2 – ReCaptchaV2 solving (without parameters, the script will do all the work).
Captcha.XevilReV2full – ReCaptchaV2 solving (with parameters – in case you wanna send it by yourself).
Captcha.XevilImageUrl – captcha solving using an image url.
Captcha.XevilImageXpath – finds an image url by xpath and solves a captcha using (другой софт) api.
Captcha.XevilImageScreen – makes a screenshot and solves a captcha using (другой софт) api
Captcha.XevilImageFile – solves an image captcha.
Captcha.Base – private method (provides class functionality) api settings.
Captcha.ReV2 – private method (provides class functionality) solves a recaptcha.
Captcha.Image – private method (provides class functionality) solves an image captcha.
Captcha.Response – private method (provides class functionality) gets an api response.
How to use (you need to buy access to (другой софт) Api separately and set it up in
Captcha.Base method):
Browser.Navigate("https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=low");
Captcha.XevilReV2();
Files
Класс Files – working with files.
Files.
Files – class constructor.
Files.AddLineSync – adds a string to a file, with thread access synchronization.
Files.AddListNoSync – adds a list of strings to a file, without thread access synchronization.
Files.SaveAllTextNoSync – creates a file and write text, without thread access synchronization.
Files.GetAllLinesToStringNoSync – reads all file data in a string, without thread access synchronization.
Files.GetAllLinesToListSync – reads all file’s strings to a list of strings, with thread access synchronization.
Files.GetNextLineSync – reads a next string from a file, with thread access synchronization.
Files.GetRandomLineSync – reads a random string from a file, with thread access synchronization.
Files.CountLinesSync – counts strings amount in a file (very fast, 500 mb file in 4 sec), with thread access synchronization.
Files.CountFilesSync – counts files in a folder.
Reading and writing uses streams (FileStream, StreamReader, StreamWriter) for stability and perfomance. A simple call:
Files.AddLineSync(“text”,”file path”,”sync object”);
Http
Класс Http – working with http requests.
Http.
Http – class constructor.
Http.CookieCreate – creates cookies.
Http.PostUpload – uploads files with post-request.
Http.PostXml – sends xml with post-request.
Http.PostJson – sends json with post-request.
Http.PostSimple – a simple post-request (submit form fields).
Http.GetFile – downloads a file.
Http.GetSimple – a simple get-request.
Http.Post – post-request with parameters.
Http.Get – get-request with parameters.
Http.Exec – private method (provides class functionality) executes requests.
Http.ExecSettings – private method (provides class functionality) of requests settings (you can set up class options in this method).
Http.ExecCookie – private method (provides class functionality) of requests cookies.
Http.ExecProxy – private method (provides class functionality) of requests proxy (format: user:pass@ip:port or ip:port).
Http.ExecAuth – private method (provides class functionality) of requests authorization.
Http.ExecPost – private method (provides class functionality) executes post-requests.
Http.ExecPostData – private method (provides class functionality) of post-requests data.
Http.ExecPostUpload – private method (provides class functionality) of post-requests files upload.
Http.ExecResponse – private method (provides class functionality) gets server response.
Easy-to-use class for GET and POST requests. Proxy, authorization, uploading & downloading files, xml, json, etc. Using HttpWebRequest. You can set up timeouts (basic/read/write default 15 sec), redirects amount, buffer, useragents and headers, etc.
A simple get-request:
Http.GetSimple("http://localhost/");
A simple post-request:
Http.PostSimple("http://localhost/", "inptxt=mytestvalue&inpsubmit=ok");
A simple post-upload:
Http.PostUpload("http://localhost/", "inptxt=mytestvalue&inpsubmit=ok", @"inputname=inpfile&filename=c:\logo.gif&type=image/gif");
Email
Класс Email – working with e-mail.
Email.
Email – class constructor.
Email.ConfirmLinkSingle – connects to a server and searches for a link in letters.
Email.DeleteAll – deletes letters.
Email.GetConfirmLink – private method (provides class functionality) gets a link.
Email.FindInBody – private method (provides class functionality) searches for a link.
Email.ConnectPop – private method (provides class functionality) connects to a server.
A simple call:
Email.ConfirmLinkSingle(“server address” ,”login” ,”pass” ,”search in address” ,” search in theme” ,” search in letter”);
Procs
Класс Procs – working with processes.
Procs.
Procs – class constructor.
Procs.RunAndReadOutput – runs a process using CMD with arguments (hidden window) and gets a list of output strings.
Procs.MemoryCurrent – checks ram consumptions of the current process (causes memory leaks, for debug purposes only).
Procs.MemoryByName – checks ram consumptions by process name (causes memory leaks, for debug purposes only).
Procs.GetPidCurrent – gets pid of the current process.
Procs.GetPidByName – gets pid of a process by name.
A simple call:
Procs.RunAndReadOutput(“path to a file”,“args”);
Screens
Класс Screens – creates screenshots.
Screens.
Screens – class constructor.
Screens.Full – a viewport screenshot.
Screens.Crop – a cropped screenshot using coordinates.
A simple call:
Screens.Full();
Elem
Класс Elem – working with html elements.
Elem.
Elem – class constructor.
Elem.GetAttribute – gets an attribute’s value of an element.
This class is just a facade for zenno methods, which adds some checking, exception handling and logging and shortens your code.
A simple call:
Elem.GetAttribute(element, attributeName);
It’s much shorter than a whole code, isn’t it?
public static string GetAttribute(HtmlElement el, string attrName, bool throwError = true, bool throwLog = true)
{
string attrValue = "";
if (el != null && !el.IsNull && !el.IsVoid && !el.ErrorDetected)
{
attrValue = el.GetAttribute(attrName);
if (attrValue == null || attrValue == "")
{
if (throwLog) { Logs.MsgError("empty attr value " + attrName); }
if (throwError) { Registry.SetErrorWorker(); }
}
}
else
{
if (throwLog) { Logs.MsgError("can’t get attr value – can’t find an element on the page"); }
if (throwError) { Registry.SetErrorWorker(); }
}
return attrValue;
}
FindElem
Класс FindElem – searching for html elements.
FindElem.
FindElem – class constructor.
FindElem.SingleWaitForValue – searches for an element, which value has to change.
FindElem.XpathClick – searches for an element by xpath and clicks on it.
FindElem.XpathScroll – searches for an element by xpath, scrolls to an element and mouse over an element.
FindElem.XpathSendText – searches for an element by xpath and filling it in (for text fields).
FindElem.XpathClickSendText – searches for an element by xpath, clicks on it and filling it in (for text fields).
FindElem.SingleById – searches for an element by id.
FindElem.SingleByTag – searches for an element by tag.
FindElem.SingleByName – searches for an element by name.
FindElem.SingleByXpath – searches for an element by xpath.
FindElem.CollectionByTag – searches for an elements collection by tag.
FindElem.CollectionByName – searches for an elements collection by name.
FindElem.CollectionByXpath – searches for an elements collection by xpath.
FindElem.ChildById – searches for a child element by id.
FindElem.ChildByTag – searches for a child element by tag.
FindElem.ChildByName – searches for a child element by name.
FindElem.ChildByXpath – searches for a child element by xpath.
FindElem.ChildrenByTag – searches for a child elements collection by tag.
FindElem.ChildrenByName – searches for a child elements collection by name.
FindElem.ChildrenByXpath – searches for a child elements collection by xpath.
FindElem.Single – private method (provides class functionality) searches for an element.
FindElem.Collection – private method (provides class functionality) searches for an elements collection.
FindElem.Child – private method (provides class functionality) searches for a child element.
FindElem.Children – private method (provides class functionality) searches for a child elements collection.
This class is just a facade for zenno methods, which adds some checking, exception handling and logging and shortens your code.
A simple call:
FindElem.XpathAndClick(“xpath”);
Registry
Класс Registry – vars registry, library settings, emulation levels, global zenno vars, etc.
Registry.
Registry – class constructor.
Registry.ClearErrors – clear errors.
Registry.CheckPermission – check permissions.
Registry.SetErrorWorker – set worker’s error.
Registry.SetErrorCrit – set critical error.
Registry.Local – library settings, emulation levels
Registry.Global – global zenno vars
Registry.WorkerNext – you can set up amount of iterations and its conditions here instead of zennoposter.
Crypto
Класс Crypto – working with cryptography.
Crypto.
Crypto – class constructor.
Crypto.StringMD5 – gets MD5 hash for a string
Crypto.FileMD5 – gets MD5 hash for a file
Use to compare strings and files.
A simple call:
Crypto. FileMD5 (“file path”);
Logs
Класс Logs – logging class.
Logs.
Logs – class constructor.
Logs.Start – log initialization (calls automatically on library initialization).
Logs.HandleErrors – sends error information to log.
Logs.HandleErrorsZenno – sends error information to zenno log.
Logs.MsgError – sends error messages to log.
Logs.Msg – sends messages to log.
Logs.Flush – sends cached messages to a method, which writes it to a file.
Logs.Stop – stops logging (calls automatically)
Logs.StartVars – private method (provides class functionality), sets init logs vars.
Logs.Write – private method (provides class functionality), caches log messages.
Logs.WriteError – private method (provides class functionality), caches error messages.
Logs.SavePageDom – private method (provides class functionality), saves pages, which caused an error.
Logs.ElapsedTime – private method (provides class functionality), show thread elapsed time.
Logs.SaveTxt – private method (provides class functionality), writes cached messages to a file.
You can set up log parameters – which log system to use (my or zenno, both or separately), turn on & off debugging, writing to files, log only errors, make screenshots, save pages, etc
Send a message to log:
Logs.Msg(“text”);
Send an error to log:
Logs.MsgError(“error text”);
Detailed info about error in try{}catch{}:
Logs.HandleErrors(exception);