View all web browser and mobile devices available in our cloud-based test lab.
Go beyond the basics with this advanced Selenium tutorial. Together, we’ll walk through the process of automated testing with Selenium step by step and provide expert advice along the way.
Read along or jump ahead to whichever section interests you most:
Before we get into the Selenium tutorial, let’s review some basics of Selenium itself. Selenium testing tools are comprised of Selenium IDE, Selenium WebDriver, and Selenium Grid.
Here are nine simple steps that break down how to use Selenium.
1. Install Selenium
2. Select a test framework
3. Apply real user conditions
4. Add Perfecto Connect
5. Instantiate web driver against the test environment
6. Add variables
7. Execute the tests
8. Review test results
9. Tag bugs in Jira
Learn how to run Selenium automated tests with Java and Quantum in Perfecto. Watch this advanced Selenium tutorial in step by step detail, or read below for a summary.
First, you’ll need to install Selenium. You can download Selenium to get started.
In the Eclipse IDE, start with a simple, responsive Java script. The one in our example tests the Boston Globe for availability within a particular zip code. For the test automation framework in this example, we’re using Quantum. Quantum is a BDD test framework and is Perfecto’s contribution to the open source community. So, here you have very simple Java inside of the Quantum framework.
Note that the creation of test automation scripts can be done with any framework you happen to be familiar with or any one that matches the skillsets of your automation or test engineers. For example, you can use code-based, codeless, or BDD frameworks depending on the skillsets of your team members. Whatever language your organization is familiar with, feel free to use that with the authoring of the test scripts.
You can also apply real user simulation testing, which applies real test conditions to the test. You can test location, network coverage, and use of other applications in the background. Network virtualization allows you to get more accurate test results for the end user.
You can also add a Perfecto Connect transport layer security tunnel to your test by adding the tunnel ID. This allows you to leverage Perfecto’s secure VPN.
You can add a catch/try exception which comes into play if you fail to inquire about the browser selection. You can add some additional time outs to ensure your script takes screenshots from test to test, or from sections of the test.
You can opt to generate 4G LTE or a HAR file if desired. At this point you can enter in your variables which include the Boston Globe homepage in this example, the zip code, the selection of length, etc.
Next, run the script against your designated platforms. In this example, we’ve selected nine browser OS combinations to run against. With Perfecto, you can spin up nine virtual machines to run 198 test combinations across those various browser OS combinations, in the space of 15 minutes. See Perfecto’s supported platforms >>
Once the tests are done, the Perfecto test lab releases the VMs and does a quick cleanup. Then, your subsequent test analytics are available inside of the report library.
With Perfecto, you can play back your tests to see what went wrong. You can play back the actual video capture itself, that you specified in your code. As the test flow is moving along, you get to see what's happening on the device as the test is running, even though the test has already concluded.
You can also capture HAR files and the device log that shows CPU utilization, Wi-Fi network, and bytes in bytes out. All of the usual device logs and statistics are available there.
As you examine your failed tests, you may need to send them back to your dev team. Fortunately, Perfecto has aJira integration which allows you to create a Jira ticket with the click of a button. That allows you to get the full traceability and issue tracking benefits of Jira with Perfecto.
Selenium is an excellent open source framework. But it can’t do it all.
Pair open source technology with Perfecto, an enterprise-grade platform with all of the devices and browsers to run your Selenium test scripts on.
With Perfecto and Selenium, you can:
Experience the world’s largest global testing cloud for web and mobile apps. Try Perfecto free for 14 days.
Senior Solutions Engineer , Perfecto
Leslie Tan is a Senior Solutions Engineer at Perfecto. He’s been in the testing space for the last six years across desktop web, mobile and performance, and availability testing. Helping DevOps professionals understand that continuous testing is key to their success is what keeps him up at night. He postulates that a solid CI/CD testing strategy is key to an organization’s success in this digital transformation era. Prior to that, he spent over nine years at Microsoft as a Solutions Engineer and Technology Strategist for state and local government.