Selenium and Salesforce – Salesforce automation testing – Video tutorial – Part 1

This is first post of multi-series article on using Selenium with Salesforce for Automation testing. Testing has always been integral part of any software development life cycle and Salesforce has already taken it to next level by making mandatory to have 75% of code coverage before any code deployment. These apex test classes, however has its limitations where we can only test Apex code written. I have seen most of Salesforce project ending with manual testing. Audience for this series is not only developer but Salesforce admin and of course manual testers as well and please feel free to drop comment throughout this series if I left any area or topic uncleared.

What is Selenium 

Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese)[1] to write tests in a number of popular programming languages, including Java, C#, Groovy, Perl, PHP, Python and Ruby. The tests can then be run against most modern web browsers like firefox, Chrome, Internet explorer. Selenium deploys on Windows, Linux and Macintosh platforms.

Selenium and Salesforce
Selenium and Salesforce

How Selenium can benefit me 

Its not only Automation testing where you can leverage selenium. You can use this tool to move some manual changes from one Salesforce organization to another, to avoid preparing test data every time when sand box is refreshed and so on.. usability is endless.

Installing Selenium

  1. Download and install Firefox browser
  2. Add Selenium IDE Plugin for Firefox from official Selenium download website

Once Selenium plugin is installed in Firefox we can launch Selenium IDE and it will look like below screen

Firefox Selenium IDE
Firefox Selenium IDE

As you can see in above image, red circle icon is used to record step and once it is recorded, can be re-run using green symbol. Complete step are explained in Video tutorial.

Error : Selenium element not found

Chances are very high, where we will receive error in selenium script about “Element not found”. This is because if some content is loaded via Ajax, Selenium doesnt know that it needs to wait. There are many ways to handle it, but for me “waitForElementPresent” works in most cases.

 Selenium Test Case code snippet

Sample Selenium Script
Sample Selenium Script

Video Tutorial 

Related posts

8 thoughts on “Selenium and Salesforce – Salesforce automation testing – Video tutorial – Part 1”

  1. Hi, How to handle dynamically changing web elements of standard objects for Salesforce UI automation. Thanks.

  2. Very Very helpful videos We are planning to automate some functionality in salesforce. Could you please upload videos of automate salesforce basics functionalities. . It would be a great help!! Thanks for sharing your knowledge.

  3. Hello, what is your experience with Spring 17 release and using selenium to test pages where aura components are rendered. The elements rendered are not available to the webdriver like other elements

  4. Hello,
    Thank you for the post, I found the video is very useful. I would have a question if you encountered the issue with verification code ? I am using Robot Framework that is using Selenium to open new browser window and login to Salesforce. I manage to successfully login to Salesforce but my test script stops because of the Verification screen. One of my guess was that the cache of the browser was cleaned up before opening a new browser window. I would appreciate any help.

Leave a Reply