Selenium is by far the most popular open source automation framework for functional testing of web applications, with over 81% of respondents using it, according to our State of Open Source Testing 2020 Report. While many users find it easy to get going with Selenium, they can often get tripped up with more complex test scenarios, which cannot be handled easily. In our experience working with tens of thousands of different web applications, we have found that the most common challenges in automating with Selenium on its own include the following:
Selenium Challenges
- Dynamic Elements
- iFrames
- Hover Menus
- PopUps
- Waits and Timeouts
- Browser Variations
- Testing Across Tabs/Windows
For a variety of different reasons, these obstacles can slow down Selenium testing, or even bring it to a halt in many cases. In other cases, users must invest heavily in complex coding which can be difficult to maintain in many scenarios.
Fortunately, TestProject has focused attention and effort on these scenarios, adding AI powered Self Healing technology in its latest release of the Smart Recorder. Since TestProject is built on top of Selenium, you can get the benefits of Selenium with additional features to overcome the most common and difficult Selenium challenges, and all 100% for free.
Let’s explore the most common Selenium challenges, and understand how TestProject’s new enhancements can assist in overcoming these challenges with ease.
❗ In all the examples below, we used Salesforce application, demonstrating how TestProject’s Smart Recorder seamlessly overcomes these common Selenium challenges, even while automating such a complex application as Salesforce!
Dynamic Elements
What is it? Elements that change locators with each page load. Oftentimes, it is the ID that changes, as it is generated dynamically on each page load. Dynamic elements are common in many of the more complex packaged applications such as Salesforce and SAP Fiori.
Why is it a problem? Changing locators means that whatever static locator was implemented in the original test case will most likely fail to execute in a later execution, since the locator will be different after a fresh page load. This means the test may be unable to complete any step where a dynamic element is present, creating many false positives in its wake.
How TestProject can help? TestProject offers its AI-powered Smart Recorder, which can use Self-Healing technology to update locator strategies when dynamic elements change locators. Better yet, TestProject will update to a more robust locator strategy, so your test will run smoothly in subsequent executions.
iFrames
What is it? An iFrame is basically a webpage within another webpage. They are commonly used in more complex packaged applications like Salesforce and SAP. Additionally, they are a popular way of embedding 3rd party content (like ads) into a webpage.
Why is it a problem? Working with iFrames using Selenium is not an easy task. You must build sound logic using code to select the right frame to interact with. Otherwise, Selenium will fail to find your locator, since it is looking in the wrong place to begin with.
How TestProject can help? TestProject’s Smart Recorder can handle iFrames with ease. Simply click through your test scenario normally as any user would, and TestProject’s AI will handle all of the frame switching and complex logic creation for you.
See it in action 👉
Hover Menus
What is it? Menus that only appear when you put your cursor over them. For example, when browsing an e-commerce site, there might be a menu where you can hover your cursor over a menu and a dropdown of options will appear.
Why is it a problem? Hovering over an area on the screen is nearly impossible with Selenium, and often the cursor will move too quickly to allow the menu to drop down properly and be interacted with. Because of this, the test will often fail when unable to find the element needed, causing additional false positives in your report.
How TestProject can help? With TestProject’s Self-Healing, we can learn how to interact with your elements, even if they aren’t visible to the human eye or tools like Selenium. TestProject’s AI will automatically attempt JavaScript clicks to click the element, even if it’s not visible – meaning your test can still execute and return an accurate result.
See it in action 👉
PopUps
What is it? We all know these pesky intruders that can show up at inopportune moments and frustrate you while using your app.
Why is it a problem? While popups may only provide a minor annoyance to a human user, they can bring test automation tools completely to a halt. When they show up unexpectedly, popups can make the rest of the page unreachable, stopping the test in its tracks. To make matters worse, testers will often build steps to close the popup window explicitly, only to have that popup not appear – and the test fails for that reason.
How TestProject can help? With TestProject’s ClickifVisible command, you can train TestProject to use its AI to overcome popup annoyances. These flexible test arguments allow TestProject to close popups when they show up, but simply move on and keep executing the test when they don’t.
See it in action 👉
Waits and Timeouts
What is it? Waits are the length of time (in seconds or milliseconds) which Selenium will wait in between executing commands against an application. Related to waits are timeouts, which are general thresholds of time after which point if something hasn’t happened, a test step will fail.
Why is it a problem? One of the major drawbacks of Selenium vs. some of the newer test frameworks is the way it handles waits and timeouts. Essentially, the user needs to explicitly define the wait time. Problems arise because the application rarely has the same page load speed on each test run. Inevitably, the test will be waiting for too long (meaning testing takes longer), or not long enough (meaning the test fails and creates a false positive).
How TestProject can help? TestProject’s Adaptive Wait functionality brings AI to the table to solve challenges around waits and timeouts. With this feature, you can set a maximum time allowable to wait, which will never be exceeded. However, TestProject’s AI will continually try to perform the action before the wait time is exceeded. If the action can be performed earlier, it will be – saving you precious time without incurring any additional false positives.
See it in action 👉
Browser Variations
What is it? Any experienced automation engineer has run into this scenario before – where the test works perfectly in one browser, only to fail minutes later when tested against another browser version or type.
Why is it a problem? Cross browser compatibility is a must in today’s age, and is one of the major benefits of Selenium. However, maintaining a separate version of each test for every browser is impossible and would lead to endless test maintenance.
How TestProject can help? When locators change slightly from one browser to the next, TestProject’s AI will step in and choose more appropriate locator strategies to ensure your tests continue to run smoothly. Plus, TestProject’s integrations to Sauce Labs and BrowserStack allow you to quickly run your web tests against 1,000’s of browser variations in seconds.
See it in action 👉
Testing Across Tabs/Windows
What is it? It is common in today’s complex application landscape to need to complete a test which traverses multiple browser tabs or even windows. Oftentimes, you may need to interact with multiple sites as well, validating that information has flowed properly from one system to another.
Why is it a problem? Maintaining the state of a browser and user data across multiple tabs or windows can be a monumental task. Especially when it comes to record and playback solutions, they are often confined to a single browser tab, making it impossible to capture these complex scenarios properly.
How TestProject can help? TestProject’s can use its AI to traverse multiple tabs and windows, while maintaining the state of the test and transferring test data. Even TestProject’s Smart Recorder can keep up in these scenarios – allowing you to leverage record and playback approaches in even the most tricky situations.
See it in action 👉
So, we can see that TestProject’s new Smart Recorder features can be a huge help to us in expanding our automation coverage and negotiating the most difficult web applications we test. We’d encourage you to try out these new features for yourself to see how you fare with this exciting new offering and overcome these common Selenium challenges with ease! ✨
Simply follow these steps to get started with TestProject’s Smart Recorder:
- Create a free TestProject account
- Follow the wizard to Record a Codeless Test
- Download and install the TestProject agent
- Choose to create a new test
- Record your scenario using TestProject’s Smart Recorder!
If you have any questions, feedback, or need help getting started, please don’t hesitate to contact us, we’re always happy to assist you.
Happy testing! 😉
TestProject Team