Introducing Selenium Support in IntelliJ IDEA
WARNING! The Selenium UI Testing plugin has been deprecated. The Selenium UI Testing plugin has been deprecated and will no longer be supported, starting with version 2023.2. The latest developments and your favorite features for test automation in the Selenium ecosystem are available either in the Aqua plugin or in Aqua, a standalone IDE for test automation. Check out the JetBrains Aqua product page to learn more about the feature set for developing automated tests.
Selenium is a popular framework for testing web applications in the Java world, and we have decided to improve IDE support for selenium-java and its accompanying tools and libraries.
The upcoming IntelliJ IDEA 2020.1 Ultimate introduces initial support for Selenium with a new Selenium UI Automation Testing plugin. The new plugin supports the most popular JVM frameworks for UI testing and reporting libraries: Selenium, Selenide, Geb, Serenity BDD, and Allure Framework.
IntelliJ IDEA’s enhancements for Selenium include a new project wizard, highlighting, inspections and code completion in tests for Java/Kotlin/Groovy languages, validation for various configuration files, and icons in the gutter for easier navigation. Read on for more details about these enhancements, as well as some examples of how they work.
Please note that the Selenium plugin is not bundled, so you’ll need to install the plugin before using this new functionality. Go to Preferences | Plugins | Selenium UI Automation Testing plugin, or download the plugin from the website. The new Selenium plugin is only compatible with IntelliJ IDEA Ultimate.
New project with Selenium and test libraries
Once the Selenium plugin is installed, you can create a UI test project directly from the New Project wizard. The dialog will walk you through the initial configuration, where you can specify the JDK; build tool – Maven or Gradle; test runner – JUnit or TestNG; language – Java, Kotlin, or Groovy; and additional test libraries.
If you prefer using Groovy or Kotlin as your language for UI tests, there are additional helper libraries: Geb and Balin. They become available if you choose the corresponding language in the first step:
XPath and CSS language fragments
Working with XPath and CSS selectors can be challenging, as it requires knowledge of many edge cases and language details. To make your life easier we have added code insight support for XPath and CSS, which are used in Selenium API as well as in many other libraries for UI testing.
Code completion for HTML tags, attributes and CSS properties
There are many ways to obtain WebElements in Selenium, and you may switch between them, by using HTML tag names, for instance:
Code completion and validation for
Selenium Grid 3 configuration
It is not so easy to configure a test environment for Selenium, and the IDE now helps you edit the Selenium Grid 3 configuration files: hubConfig.json and nodeConfig.json.
Code completion and validation for Selenoid configuration
Another popular tool for UI testing with multiple browser versions is Selenoid. When you edit the browsers.json file, you will get code completion and validation by schema that is similar to what you get for Selenium Grid files:
Line markers with navigation to issues and TMS cases in web browser
Tests usually contain links to issue trackers and test management systems, and to make this possible, developers use reporting libraries, such as Allure Framework, or built-in test framework mechanisms, for instance, Serenity BDD. We have added support for the annotations of these libraries, and the IDE can now open issues or TMS cases in a web browser just by clicking on the issue ID:
Line markers with quick navigation to step usages
Step methods are common building blocks of UI tests, and we now provide a quick usages popup for methods with @Step annotations. It contains all usages grouped by origin method:
Find usages and code completion for Allure Framework annotations
There are many useful metadata annotations in modern reporting libraries, for instance the @Lead and @Owner annotations of Allure Framework. The IDE provides code completion for leads and owners already used in the project:
Stacktrace foldings for Run & Debug
Sometimes tests fail and you need to check their stack traces with tons of internal stack frames from different libraries. We have simplified this, and the IDE now hides unnecessary stack frames in folding regions:
We hope you are looking forward to trying out all these new features. Let us know what you think in the comments below or on Twitter.
Subscribe to Blog updates
Thanks, we've got you!
End of Support for the Tapestry, JBoss Seam, and Vaadin plugins
We are continuing our efforts to focus our attention on the most popular technologies and integrations. However, since our capabilities are limited, this requires sunsetting some plugins that are no longer in high demand among the community. Given the low popularity of the Tapestry, JBoss Seam, and…
Ensure Greater Software Security With Package Analysis by Checkmarx in IntelliJ IDEA
Today we are happy to announce the partnership between JetBrains, a global software vendor that creates professional software development tools and advanced collaboration solutions, and Checkmarx, a global leader in developer-centric application security testing (AST) solutions. Checkmarx SCA (So…
AWS in IntelliJ IDEA
In this blog, we're going to explore how to work with Amazon Web Services (AWS) in IntelliJ IDEA. We'll start by setting up IntelliJ IDEA to connect to AWS. Then, we'll highlight a few features that are beneficial when working with AWS from your IDE. This blog post covers the same material as the…
Top 10 Plugins for IntelliJ IDEA You Don’t Want to Miss
Though IntelliJ IDEA is a fully capable IDE, you may want to personalize it. The JetBrains Marketplace has plenty of plugins with useful features that can address your personal or business-specific needs. The library is enormous, and it can be a bit easy to get lost. In this blog post, we’ll shar…