HtmlExtensions
static class · namespace z3n7 · source Browser/HtmlExtensions.cs
public static class HtmlExtensions
Helpers for ZennoPoster HtmlElement: centre point, QR decoding, XPath.
Methods
Center
public static Point Center(this HtmlElement element, Point origin)
Extension method for HtmlElement. source
Centre of the element relative to origin (bounding-client size when known, else the element size).
| Parameter | Description |
|---|---|
origin |
Top-left corner of the element. |
Returns: The point. Throws when the element is null or void.
DecodeQr
public static string DecodeQr(this HtmlElement element)
Extension method for HtmlElement. source
Draws the element and decodes a QR code from the picture (ZXing).
Returns: The decoded text, or one of elementZeroSize, bitmapIsNull, qrIsNull, or an exception message. Never throws.
GetXPath
public static string GetXPath(this HtmlElement element)
Extension method for HtmlElement. source
Builds an XPath for the element by walking up to body. Each step uses @id, else the first class, else @name, else the position among same-tag siblings.
Returns: The XPath, starting with //*; empty for a void element.
VerifyXPath
public static bool VerifyXPath(Tab tab, HtmlElement originalElement, string xpath)
Checks that the first element found by xpath in tab has the same outer HTML as originalElement.