Browser Java Module

The Browser module contains a number of Java methods that enable a robotic process to open and interact with web browsers. Through this module, you can navigate to a URL and interact with the web page just as a human would: click on the page controls, select options, enter values in text fields, retrieve HTML items, and more.

This page describes how to integrate browser methods into your robotic process using the Java module. See the low-code Browser module page for guidance in an easier and more robust development experience.

To use the Browser module in your projects, you first must include the module dependency in the pom.xml.

Browser module architecture

The Browser module requires Selenium to work properly and interact with browsers.

Components

This area describes each of the components needed to work with the Appian RPA Browser module:

  • Java Selenium drivers: Appian RPA uses the Selenium WebDriver API, which contains different language-specific implementations, such as Java. The Java implementations, included in the Maven dependency selenium-java, are called drivers. It is important to know this terminology to avoid confusion.
  • Servers: executable programs that drivers communicate with. Drivers use servers to interact with browsers. These servers, sometimes known as proxies, are necessary and are available to download as external components, since they are developed by third parties (except for Internet Explorer). This page uses the term servers to avoid confusion.
  • Browsers: the web browsers to use in the automation. The following table summarizes browser and resource compatibility:

      Windows Mac Linux
    Chrome Supported Supported Supported
    Firefox Supported Supported Supported
    Edge Supported Supported Unsupported
    Internet Explorer Supported Unsupported Unsupported
    Opera Supported Unsupported Unsupported

The following image shows how all these components are connected:

rpa-browser-module-components

Different servers available for each supported browser:

Once downloaded, you must add the driver to the robotic process configuration as Support Files. Usually, a robotic process will only have to interact with one browser, so you don't need to upload all the files shown in the image.

Here is what the support file structure looks like for the various resource types:

Windows:

rpa-browser-windows

Driver paths for Windows are case insensitive. The path can begin with an upper or lowercase letter (ChromeWebDriver or chromeWebDriver) and the robotic process will reference both with the same result.

Mac:

rpa-browser-mac

Driver paths for Mac are case insensitive. The path can begin with an upper or lowercase letter (ChromeWebDriver or chromeWebDriver) and the robotic process will reference both with the same result.

Linux:

rpa-browser-linux

Driver paths for Linux are case sensitive and must begin with an uppercase letter, for example: ChromeWebDriver. If the path doesn't begin with an uppercase letter, the robotic process won't be able to reference the support file.

Compatibility between components

Not all versions of each component are compatible with each other. We recommend that you always work with the most recent versions of the browsers and their bridge servers. In all cases, they must be compatible with the Selenium version integrated into the Appian RPA Browser module. Visit the links below for each web browser to know what versions are supported for the rest of the components:

IE11 requirements

If you're using the Browser module with Internet Explorer 11, use the following browser settings to ensure that the robotic process can successfully interact with the browser:

  • Browser zoom level needs to be set to 100%. You can find this setting under Tools > 100%.
  • Browser security needs to be set so that the Enable Protected Mode is the same for all security zones. You can find this setting under Tools > Internet Options > Security.
  • Browser pop-up blocker should be turned off. You can find this setting under Tools > Internet Options > Privacy > Turn on Pop-up Blocker. Clear the checkbox. If pop-ups are blocked, the Open Browser method won't be able to open a new window if one is already open.

Using the Browser Java module

This section highlights some commonly used aspects of the Browser Java module. You can find complete documentation for Appian RPA's Java methods in the Appian RPA console by clicking Help > Javadoc.

Initialize the browser and set timeout

The core interface of the Appian RPA Browser module is com.novayre.jidoka.browser.api.IWebBrowserSupport. This interface provides the methods to interact with the browser and the components of a page.

This code snippet calls the interface:

1
2
IWebBrowserSupport browser =
    IWebBrowserSupport.getInstance(this, client);

Where client is an instance of IClient and this is a reference to the robotic process that uses the module.

Once the instance of IWebBrowserSupport is called, we should properly initialize it. Set the browser to use and the default timeout:

1
2
3
// Set the browser to Chrome
browser.setBrowserType(EBrowsers.CHROME);
browser.setTimeoutSeconds(60);

In this example, Google Chrome is set as the browser with a timeout of 60 seconds.

The enumerator type EBrowsers contains the identifiers for all the supported browsers: CHROME, EDGE, INTERNET_EXPLORER, FIREFOX, and OPERA.

To set other browsers:

1
2
3
4
5
6
7
8
9
10
11
// Set the browser to Edge
browser.setBrowserType(EBrowsers.EDGE);

// Set the browser to Internet Explorer
browser.setBrowserType(EBrowsers.INTERNET_EXPLORER);

// Set the browser to Mozilla Firefox
browser.setBrowserType(EBrowsers.FIREFOX);

// Set the browser to Opera
browser.setBrowserType(EBrowsers.OPERA);

Putting it all together, the full code to initialize the Browser module is:

1
2
3
4
5
6
7
8
9
10
// IClient
IClient client = IClient.getInstance(this);

// IWebBrowserSupport
IWebBrowserSupport browser =
IWebBrowserSupport.getInstance(this, client);

// Set the browser to Internet Explorer
browser.setBrowserType(EBrowsers.INTERNET_EXPLORER);
browser.setTimeoutSeconds(60);

Opening the browser and loading a web page

Now that you have properly initialized the browser, you can open it and navigate to a web page. This example will open the browser and visit the Appian website:

1
2
3
4
5
6
// Open browser
browser.initBrowser();

// Navigate to a URL
String url = "http://www.appian.com";
browser.navigate(url);

FAQ

To use the Browser module, I need three components. How can I know which version of each component to use?

Appian RPA relies on the Selenium WebDriver API to simulate user interaction in the browsers. Consult the Selenium documentation below for your browser and your browser version. Refer to the Browser module architecture for instructions on how to configure the robotic processes.

Browser Page
Firefox https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
Chrome https://sites.google.com/a/chromium.org/chromedriver/downloads
IE11 https://raw.githubusercontent.com/SeleniumHQ/selenium/master/cpp/iedriverserver/CHANGELOG
Opera https://github.com/operasoftware/operachromiumdriver/releases

For further information, go to the Selenium website.

How can I move through tabs that open in the browser?

When a new tab is opened by the browser either automatically or as the result of a user action, you are required to explicitly switch to this tab if you want to interact with it.

To change from one tab to another in the Browser module, you must call the switchTo() method as described below:

  • Get the open windows/tabs using the driver with the method browser.getDriver().getWindowHandles();
  • Switch to the desired window/tab using the method browser.getDriver().switchTo().window(…);

Example:

1
2
3
List<String> tabs = new ArrayList<String>(browser.getDriver().getWindowHandles());

browser.getDriver().switchTo().window(tabs.get(tabs.size() - 1));

The Browser module does not locate an element I'm visualizing in the browser inspector because it is in another frame. How do I access it?

To access the elements contained in another frame or another pop-up window, you must be positioned inside it. Using the element inspector of the browser, get the name of the frame containing the element to find and use it in the method browser.frameSetNavigation(String frame).

Can I use JavaScript in my robotic process code?

Yes, the Browser module is developed from Selenium and the developer can use all the options that Selenium offers by getting the driver invoking browser.getDriver().

To run JavaScript, use the following code:

1
2
3
JavascriptExecutor jsExecutor = ((JavascriptExecutor) browser.getDriver());

jsExecutor.executeScript("YOUR CODE HERE");

The findElement(By by) method take a lot of time when the WebElement is not present. Why?

The purpose of the method findElement is to wait for a page to be completely loaded and to find an element on this page. As such, this method uses the default timeout defined in the Browser module (60 seconds). This means that if the element is not present on the page, the method keeps looking for up to 60 seconds.

To find a WebElement that is not always present in the page, use one of the following options:

  • Use the existsElement() method, which has a shorter default timeout.

    1
    2
    3
    4
    5
    
      if (browser.existsElement(By.xpath("//xpath/expression"))) {
            server.info("Doesn't exist the element");
      } else {
            // ...
      }
    
  • Modify the timeout used by the findElement method: browser.setTimeOutSecondsWaitElement(int second);

If you change this timeout for a specific action, it is recommended to restore it afterwards.

Use these tutorials to learn more about the Browser module:


This version of the Appian RPA documentation was written for Appian 21.2, and does not represent the interfaces or functionality of other Appian versions.
Open in Github Built: Fri, Oct 22, 2021 (11:14:24 AM)

On This Page

FEEDBACK