Selenium 3 upgrade guide

Preparing for Confluence 8.2

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

We plan to upgrade the version of Selenium provided by Confluence in our Confluence 8.6 release. To ensure a smooth rollout, we've provided a way to test your apps well ahead of time.

This page contains instructions to test your apps with Selenium 3, and the latest information about the upgrade.

What is changing?

We will upgrade Selenium from 2.x to 3.x in Confluence 8.6. Work for this has already started internally.

If your app has tests that use the version of Selenium provided by Confluence, then it’s possible some of your tests may break when you update your app to use Confluence 8.6.

Note: We previously stated that the Selenium upgrade would happen in Confluence 8.5. This has been updated since Confluence 8.5 is an Long Term Support release and we don't want to introduce any potential breaking changes here.

Preparing to upgrade

Nothing needs to be done urgently, but you should figure out if your tests will need to be updated in the future.

The current default test module provided by Confluence is Selenium 2.5.11, so we’ve shipped another test module in Confluence 8.2.0 that provides Selenium 3.3.2 as an additional and optional module for you to test with. If you wish to test your app with Selenium 3, simply modify the pom in your app to use this new test module.

Test your app with Selenium 3.x

In the </dependencyManagement> of your pom.xml, update confluence-plugins-platform-test-pom to confluence-plugins-platform-test-selenium3-pom and set the version to at least Confluence 8.2.0.

The new test pom can provide the following:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-stateless-test-runner</artifactId>
            <version>8.0.5</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-webdriver-pageobjects</artifactId>
            <version>11.4.12</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-webdriver-core</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-pageobjects-elements</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-pageobjects-elements-aui</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.browsers</groupId>
            <artifactId>atlassian-browsers-auto</artifactId>
            <version>3.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>31.1-jre</version>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>5.1.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

In your app, you can define which dependencies you want to use from the new test module and confirm them with mvn dependency:tree.

Troubleshooting

What if my tests are broken?

After moving from Selenium 2 to Selenium 3, some of your existing Selenium tests may be broken.

There's usually not too much work involved in updating tests for Selenium 3. 

The table below lists some basic examples to be used as a starting point to fix broken tests. We'll continue to add to this as we come across more examples. This won't be an exhaustive list as we don’t know the exact way your tests are written.

Error

Solution

cannot find symbol

[ERROR] symbol: class
AtlassianWebDriver

Inject WebDriver from Selenium instead



cannot find symbol

[ERROR] symbol: method
executeScript(java.lang.String)

Inject JavascriptExecutor and use the method from it instead

import javax.inject.Inject; @Inject
private static JavascriptExecutor executor;

cannot find symbol

[ERROR] symbol: method
waitUntilElementIsVisible(org.openqa.selenium.By)

cannot find symbol

[ERROR] symbol: method
waitUntilElementIsLocated(org.openqa.selenium.By)

cannot find symbol

[ERROR] symbol: method
waitUntilElementIsNotVisible(org.openqa.selenium.By)

cannot find symbol

[ERROR] symbol: method waitUntilElementIsNotLocated(org.openqa.selenium.By)

Replace with Poller.waitUntil* methods instead 

Poller.waitUntilTrue(pageElementFinder.find(…).timed().isVisible()) Poller.waitUntilTrue(pageElementFinder.find(…).timed().isPresent()) Poller.waitUntilFalse(pageElementFinder.find(…).timed().isVisible()) Poller.waitUntilFalse(pageElementFinder.find(…).timed().isPresent())

cannot find symbol

[ERROR] symbol: method
elementExists(org.openqa.selenium.By)

cannot find symbol [ERROR] symbol: method
elementIsVisible(org.openqa.selenium.By)

Replace with com.atlassian.webdriver.utils.Check#elementExists/elementIsVisible

cannot find symbol

[ERROR] symbol: class Waiter

Replace such usages with its equivalent com.atlassian.pageobjects.elements.query.Poller.waitUntil* methods or WebDriverPoller where applicable

cannot find symbol

[ERROR] symbol: method toggle()

Replace with  {{Poller.waitUntilTrue(element.timed().isPresent());
element.click();}}

cannot find symbol

[ERROR] symbol: method getKeyboard()

Replace with new Actions(driver).sendKeys().perform;

cannot find symbol

[ERROR] symbol: method getBrowser()

Inject BrowserAware interface and use it to get browser.

cannot find symbol

[ERROR] symbol: static sameThreadExecutor

Replace with MoreExecutors.newDirectExecutorService()

waiter.until(30).element(By.cssSelector(".create-dialog-create-button")).isEnabled();

Poller. waitUntilTrue(pageElementFinder.find(By.id(".create-dialog-create-button")).timed().isEnabled());

org.openqa.selenium.internal.Locatable;

org.openqa.selenium.interactions.Locatable;

import com.atlassian.webdriver.testing.annotation.TestBrowser;

Replace with com.atlassian.pageobjects.browser.RequireBrowser

If the plugin is using an older version of Jira, it’s likely it brings AtlassianWebDriver and causes compile errors.

Upgrade to at least Jira 8.20.20 Long Term Support release

Errors related to Jira objects from package:

com.atlassian.webdriver.jira

Replace with com.atlassian.jira.pageobjects

Problems related to pageobjects such as ConfluenceTestedProduct:

com.atlassian.confluence.pageobjects.ConfluenceTestedProduct

Make sure to use the classes from confluence-webdriver-pageobjects instead of Confluence core.

com.atlassian.confluence.webdriver.pageobjects.ConfluenceTestedProduct

Any class which extends AbstractInjectableWebDriverTest

Replace with ConfluenceStatelessTestRunner. More information to be added soon.

com.atlassian.confluence.it.User and other classes from com.atlassian.confluence.it.* (like Space or Page) not found

Replace with relevant classes from com.atlassian.confluence.test, eg com.atlassian.confluence.test.api.model.person.UserWithDetails

Last modified on Jul 17, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.