Skip to content
Michael Rätzel edited this page Nov 24, 2015 · 3 revisions

This document describes the functions available for writing scripts. Use the following code to obtain a connection to a webbrowser instance:

IBrowserProcess BrowserProcess = Limbara.App.ReuseOrCreateProcess()?.Result;

IBrowserConnection WebBrowser = Process?.ReuseOrOpenConnection()?.Result;

The types below are found in the Limbara.Interface.RemoteControl namespace.

IBrowserProcess

a browser process can host multiple browsers and has only one address to connect to.

Config

type BrowserProcessConfig {get;}

ProcessIdFromOS

id given from operating system.

type int? {get;}

GetBrowsersIds

requests identifiers of browsers hosted in the process.

return type IResultOrError<IEnumerable<IBrowserIdMeasurement>>

OpenConnection

opening the connection will fail if another connection to the browser is open.

return type IResultOrError<IBrowserConnection>
parameters
type name
IBrowserIdMeasurement BrowserId

Connections

known connections to browsers in this process.

type IEnumerable<IBrowserConnection> {get;}

IsAlive

type bool {get;}

Kill

return type void

IBrowserIdMeasurement

Id

type string {get;}

Type

The type accessible via the UI seems to be "page".

type string {get;}

Url

url at the time of measurement.

type string {get;}

Title

title at the time of measurement.

type string {get;}

ConnectionOffered

whether the hosting process has offered to connect to this browser.

type bool {get;}

IBrowserConnection

Keep in mind that the browser will close the connection when chrome devtools are attached to the browser.

BrowserId

A past measurement. changing members such as Url or Title do not reflect the current state.

type IBrowserIdMeasurement {get;}

IsOpen

type bool {get;}

Document

type IResultOrError<IDocument> {get;}

Close

close the connection, making it easier for others to connect to the browser.

return type void

Ping

returns null if ping was successful.

return type IError

IDocument

locationHref

The whole URL.
Assign to this member to initiate navigation to the passed url.
Assigning to this member will eventually result in creation of a new document. This document reference will then not be useful anymore.

type string {set;get;}

locationReload

starts reloading the resource from the current URL.
This will eventually result in creation of a new document. This document reference will then not be useful anymore.

return type void

documentElement

Element which is the root element of the document (for example, the element for HTML documents).

type IHTMLElement {get;}

GetListElementFromXPath

Returns the list of elements which match the passed XPath.
https://en.wikipedia.org/wiki/XPath

return type IEnumerable<IHTMLElement>
parameters
type name
string XPath

GetElementFromXPath

Returns the first element which matches the passed XPath.
https://en.wikipedia.org/wiki/XPath

return type IHTMLElement
parameters
type name
string XPath

getElementById

https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById

return type IHTMLElement
parameters
type name
string Id

readyState

loading state of the document.
http://www.w3.org/TR/html51/dom.html#dom-document-readystate

type string {get;}

IHTMLElement

Represents any HTML element. HTML elements may implement additional interfaces.

outerHTML

Serialized HTML fragment describing the element including its descendants. It can be set to replace the element with nodes parsed from the given string.

type string {set;get;}

innerHTML

Serialized HTML fragment describing the elements contents including its descendants.

type string {set;get;}

outerText

type string {get;}

innerText

type string {get;}

click

Sends a mouse click event to the element.

return type void

focus

Makes the element the current keyboard focus.

return type void

tagName

type string {get;}

id

type string {set;get;}

setAttribute

Sets the value of a named attribute of the current node.

return type void
parameters
type name
string attributeName
string value

getAttribute

value of a specified attribute on the element. If the given attribute does not exist, the value returned will either be null or an empty string.

return type string
parameters
type name
string attributeName

parentElement

type IHTMLElement {get;}

IHTMLIFrameElement

provides properties for manipulating the layout and presentation of inline frame elements.

contentDocument

The active document in the inline frame's nested browsing context.

type IDocument {get;}

src

URL of the embedded page.

type string {set;get;}