While Selenium Web Driver is a great automation testing tool for a wide range of use cases, there are some situations where it is not advisable to perform automation testing with Selenium. In this article, we will discuss some of the test scenarios where you should not use Selenium Web Driver as a standalone tool for test automation and why. Let’s jump in.
If you are using a Windows OS, there are some default apps that come with it. Apps such as Calendar, Calculator, Clock, Groove Music, etc. In these apps, it is impossible to use Selenium Web Driver to launch or automate them.
Microsoft has been working on creating a tool that can be used to test their applications since Selenium and Appium would not work alone. Thankfully, they developed the Microsoft WinAppDriver which works great for testing built-in Windows applications. The tool is however mostly used with the Selenium and Appium test framework.
One drawback of the WinAppDriver is that it requires a C# codebase environment in order to run first-level automation tests. You can learn more about using Selenium, Appium, and WinAppDriver by getting into an online Selenium certification training.
CAPTCHA stands for Completely Automated Public Turing tests to tell Computers and Humans Apart. It is a security measure put by web developers to ensure their website servers are not hit by computer bots too frequently. Simply put, it exists to prevent automation. If CAPTCHAs were designed to tell humans from computers, its purpose would be defeated if we captured CAPTCHA checks in our test automation.
To circumvent CAPTCHA checks in our tests, here are some things you can do.
- Turn off CAPTCHAs in your test environment. For some environments, it could be a configuration in the software used for the test. Or it could be a URL parameter set when building your test scripts.
- Add a condition that identifies CAPTCHAs and bypasses them in your automation script.
Two-factor authorization (also known as 2FA) is an additional layer of security used by many social media or enterprise applications to confirm that it is truly you that is accessing your account upon login. A one-time password (OTP) is generated and sent to an authenticator, or by email and SMS.
Automating 2FA is not impossible with Selenium but it has a couple of bottlenecks and hindrances. Even when you successfully automate 2FA, it is not usually a secure process, making the idea of 2FA defeated while still adding unnecessary layers to your test scripts. To act professionally, it is strongly advised to avoid automating 2FA.
To avoid 2FA in your test scripts, here are some things you can do:
- Disable 2FA for some users in your test environment. This allows you to use those users’ credentials for your automation.
- Disable 2FA when a request comes from certain IPs. This way, you can prevent 2FAs from popping up when requests are from your test machine IP address
- Disable 2FA in your test environment altogether.
4.Social media and email logins
As a general rule of thumb, slower test cases are bound to fail. That’s right. A study that was done on more than 2 billion tests revealed that tests that were longer than 2 minutes were two times more likely to fail.
Rather than using Selenium for automated logins for these platforms, it is advisable to use their APIs. Although using an API may seem like a lot of work, but the end result – reliability, durability, and speed are comforting.
When using Selenium with these platforms, a change in an element locator can cripple your test scripts completely. APIs on the other hand would hardly change, even if the website or web application changes.
Visual testing is loved by many web testers. It checks how a page is rendered and how the end-user sees its UI/UX for different devices. In addition, testers use visual testing to check the presence of the various elements on a web page. While all these look great, Selenium is not the appropriate tool for this. It gets even more difficult when you are trying to perform a bitmap comparison in a visual test.
It is rather weird to want to automate file downloads using Selenium. First, downloading files is not in any way a way of simulating how humans interact with a website. So it defeats the purpose of automation testing. Also, attempting to automate file downloads does not reveal the downloading progress which nobody likes.
To work around this, you can find the download link alongside any required cookies using Selenium. Then you can pass the link to an HTTP request library such as libcurl, fetch or REST Assured for further processing.
Testers can be tempted to use Selenium WebDriver to test the performance of a website but it is strongly not advisable. The reason is that Selenium was not made for such a purpose. To be fair, you would likely not get an accurate result. I’ll tell you why.
As an alternative, you should consider using tools such as Google Lighthouse for front-end performance and Apache JMeter for load and stress testing.
To get a more reliable video streaming test, consider trying out tools such as StreamTest, that can measure the user experience when streaming videos.
To wrap up
Selenium is a great tool for automation testing, but there are situations where it is not advisable to use it. This article has revealed some of those situations and better alternatives in those situations. Nevertheless, Selenium remains one of the most widely used automation testing tools with massive demand in the job market. You can become a proficient automation tester by enrolling in a project-based Selenium certification course.