BreadcrumbHomeResourcesBlog Advanced Selenium Tutorial: Learn How To Do Automated Testing With Selenium May 29, 2020 Advanced Selenium Tutorial: Learn How to Do Automated Testing With SeleniumAutomationContinuous TestingBy Leslie TanSelenium has been the de facto test automation tool for cross-browser testing for a long time, and for good reason. Selenium is versatile—it utilizes multiple languages, including Java, Java Script, C#, Python, and others, as well as multiple test environments (IDEs) and desktop browsers (Chrome, Firefox, Edge, Safari). For these reasons and more, Selenium is an excellent choice for testing teams looking to create and release high-quality applications. If you are looking to get started testing with Selenium or you are looking to go beyond the basics, this is the place for you. This advanced Selenium tutorial will walk you 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 of this Selenium tutorial interests you most:Table of ContentsThe Basics of SeleniumHow to Use SeleniumAdvanced Selenium TutorialAutomated Testing With Selenium Is Better With PerfectoTable of Contents1 - The Basics of Selenium2 - How to Use Selenium3 - Advanced Selenium Tutorial4 - Automated Testing With Selenium Is Better With PerfectoBack to topThe Basics of SeleniumBefore 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.Selenium WebDriver — Browser-based driver that helps teams access and launch different browsers across different environments.Selenium IDE — An integrated developer environment that helps you record, edit, debug, and replay functional tests.Selenium Grid — Enables parallel testing on different machines against different operating systems and browsers, otherwise known as distributed test execution.Back to topHow to Use SeleniumHere are nine simple steps that break down how to use Selenium.1. Install Selenium2. Select a test framework3. Apply real user conditions4. Add Perfecto Connect5. Instantiate web driver against the test environment6. Add variables7. Execute the tests8. Review test results9. Tag bugs in JiraTake your Selenium testing to the next level with the industry's unrivaled web and mobile app testing platform. Get started for free today with our 14-Day Free Trial!Start TrialBack to topAdvanced Selenium TutorialLearn 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.Watch This Selenium Tutorial1. Install SeleniumFirst, you’ll need to install Selenium. You can download Selenium to get started.2. Select a Test FrameworkIn 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.3. Apply Real User ConditionsYou 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.4. Add Perfecto ConnectYou 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.5. Instantiate Web Driver Against the Test EnvironmentYou 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.6. Add VariablesYou 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.7. Execute the TestsNext, 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 >>8. Review Test ResultsOnce 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. 9. Tag Bugs in JiraAs 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.Back to topAutomated Testing With Selenium Is Better With PerfectoSelenium 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:Execute web testing 50% faster than other vendors.Enjoy the scalability of Selenium Grid from the cloud.Scale your tests across multiple platforms.Find and fix bugs quickly with advanced test reporting.Integrate into your entire CI/CD toolchain.Experience the world’s largest global testing cloud for web and mobile apps. Try Perfecto free for 14 days.Try PerfectoRelated ContentHow to Use Selenium Testing ToolsWhat to Expect in the Latest Version of SeleniumTesting With Selenium: A Selenium OverviewBack to top
Leslie Tan 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.