Browser API (v5 and below)

Botfather’s Browser API can be used to control its integrated browser. It is Chromium based, super fast and all its functions can be controlled. Thus, when automating websites and browsergames, you should prefer the integrated browser over the DesktopAPI. Like most of our APIs the Browser API is compatible with the Vision API. You can take screenshots, analyze them and click somewhere on the website in response.

Additional to the “normal ways” to control browser, we provide methods to manipulate packages and modify other resources. Thats especialy usefull if you want to look for something on a website, but it’s hard to detect. - In that case you can replace it with a resource that can be detected more easily.

Note: In Botfather 6.0 multiple browser tabs will be supported.

Table of contents

Android API methods

Browser.takeScreenshot();

Returns an Image of the current website.

Browser.blockResource(resource_pattern);

Blocks resources from loading if their url matches the specified resource_pattern.

Browser.replaceResource(old_resource_pattern, new_resource);

Tells the browser to load the new_resource url whenever the requested resources url matches the old_resource_pattern.

Browser.unmodifyResource(resource_pattern);

Resets the replacement rules defined with either .blockResource or .replaceResource. One usually does not have to call this method, as modifications are reset after starting a new bot script.

Browser.unmodifyResources();

Resets all replacement rules defined with either .blockResource or .replaceResource.

Browser.loadUrl(url);

Loads the specified url asynchronously. Use .finishLoading to tell the browser to wait for the website to finish loading.

Browser.beOnUrl(url);

Loads the specified url asynchronously if the url is no loaded yet. Otherwise does nothing. This method is handy, don’t forget about it.

Browser.getUrl();

Returns the Url the browser is currently on.

Browser.reload();

Tell the browser to reload the website.

Browser.reloadIgnoringCache();

Tells the browser to reload the website ignoring the cache. This is usually slower than using the normal .reload method.

Browser.loading();

Returns true if the browser is currently loading something, otherwise it returns false.

Browser.finishLoading(timeout_seconds);

This method blocks (waits) until the browser finished loading or timeout_seconds have passed. Returns true if the website finished loading. Returns false if timeout_seconds passed before the browser finsihed loading.

Browser.stopLoading();

Makes the browser stop loading.

Browser.canGoBack();

Returns true if the browser can go back one site/url, otherwise returns false.

Browser.canGoForward();

Returns true if the browser can go forward one site/url, otherwise returns false.

Browser.goBack();

Makes the browser go one url back. This is only possible when .canGoBack returns true.

Browser.goForward();

Makes the browser go one url forward. This is only possible when .canGoForward returns true.

Browser.getSize();

Returns the browser Size.

Browser.getRect();

Returns the browsers Rect. The top left coordinates will be 0, 0 and the rectangles size will be the same as what .getSize returns.

Browser.executeJavascript(javascript_code);

Executes javascript_code in the browsers Javascript engine. This can be used to fill out login forms an sumit them. This method does not return anything (yet).

Browser.leftClick(position);
Browser.middleClick(position);
Browser.rightClick(position);

Sends a left/middle/right click to the specified pixel position.

Browser.pressLeft(position);
Browser.pressMiddle(position);
Browser.pressRight(position);

Makes the browser send a left/middle/right press event to the specified position in pixels.

Browser.releaseLeft(position);
Browser.releaseMiddle(position);
Browser.releaseRight(position);

Makes the browser release the left/middle/right mouse button at the specified position in pixels.

Browser.moveMouseTo(position);

Makes the browser move the mouse cursor the the specified position in pixels.

Browser.scrollWheel(position, delta_x, delta_y);

Makes the browser scroll the mouse wheel at the given position by delta_x pixels horizontally and delta_y pixels vertically.