Getting Started

Updated 2 days ago by Iván Minaya

Initial Setup

  1. In your Copado Org, create a new Org Credential for your Copado user (in case you don't have one already). 
  2. Make sure you have a Copado API Key.
  3. Install the Copado Selenium IDE:
    1. Install from here.
    2. If you are using Copado EU, install from here.
  4. Restart  your browser.
  5. From the "Selenium Getting Started" tab, click on the link "Bind Copado Extension to this org". This should open the Copado Selenium IDE and show your Organization name. The binding is done via your Api Key, therefore make sure you followed step 1 to create one.
  6. Create a new Selenium Settings record and set your Browser Stack/Sauce Labs account information.
    1. If using Browser Stack, login to Browser Stack. open your account Settings page (Accounts > Settings) and find your Username and Access Key. Copy these 2 values and paste them in the following WebDriver URL link:
    2. Example SauceLabs WebDriverURL:

NOTE: with both providers, if the username part is an email, the email must be escaped to fit in a URL format. E.G.: for a it should be written as format.


CommandSingle line on a test case, representing a particular actionclick copado=button:Save
DatasetNamed column with values for a test case, which can be selected in a test suite.UK and US for two sets of Account information.
Test CaseSet of commands and datasets.Create Account
Test SuiteMatching of commands and datasets in a Case, and execution of Apex pre/post test.Create Account, Create Opportunity, Add Products
Test RunExecutions of a Test Suite, in a Org Credential, with the given Selenium Settings 
Test ResultA single execution of a Test RunRun SUITE on org-user ORG.CREDENTIAL, using browsers SETTINGS
Test GroupA group of test suites to be executed in parallel in one or more environments, as one or more users (Org Credentials) 
Selenium SettingsThe virtual machine Webdriver URL provider, the platform(s) in which you want to run the tests and other options
Quick SettingsA special selenium settings that can be used to quickly test the Test Case. Choose a single platform and the Org Credentials of the org where the tests are being recorded 
Org CredentialThe Salesforce Org and the user/profile that will be used to run the tests
EnvironmentThe Salesforce Orgs, each one associated with one or more Org Credential
VariablesReplacement text variables, for the test case, dataset and pre/post Apex code. They can be Global or Group variables.{!NS} {!RUN_ID} {!Environment.ENDPOINT} {!Group.PriceBookId}
Bind ExtensionAssociate the installed extension with the Org that runs Copado, so the browser knows where to load/save the test cases. 
WebdriverLow level API to interact with a remote browser. 

Typical Selenium Commands

Command TargetValue Description
openurl Navigates to the given url, usually a partial url: /xxx/
clickelement Clicks the element
typeelementtextTypes text into the element
selectelementlabel=LABELSelects label on the picklist
copadoCheckboxelementchecked/uncheckedChecks/unchecks the checkbox element
copadoPopupelement Opens the lookup field element
copadoPopup  Closes the last lookup field
assertXXXelement Asserts that the element is present and visible
assertXXXelementvalueAsserts that the element is present and visible, and checks that the value/text/picklist value is VALUE
selectWindow  Selects the main execution window
selectPopup  Selects the last opened window
pausemilliseconds Pauses the execution for the given number of milliseconds
captureEntirePageScreenshot  Creates a screenshot of the entire page. Useful to visually confirm a change.
 copadoSetRetries number of retries millisecondsConfigure the number of retries. copadoSetRetries 50 1000 will try 50 times, waiting 1 second between tries, before failing a command.
 storeValue  element varNameSave the value of an element in a variable so that it can be used in other parts of the test case by using the following notation: ${varName}
 storeText  element varNameSave the text of an element in a variable so that it can be used in another part of the script by using the following notation: ${varName}
 comment text Set a comment for providing context to the test

Check the complete Selenese command reference.

Typical Element Locators 

copado=field:XXXForm field with label XXX
copado=detail:XXXForm field with label XXX in the SF detail page
copado=link:XXXHTML Link
copado=button:XXXHTML Button
//XPATH-EXPRESSIONGeneral page element. Several locators of varying length and precision are offered
id=IDHTML element with that ID value
name=NAMEHTML element with that NAME value
{!Locator.XXX}the locator with ID XXX on the Selenium Locators tab

Tips for creating test cases

  • If possible, use the "generate test case from last page" button. It saves time and allows to reuse the same test case for other purposes.
  • If you do record, start on the "all tabs" salesforce page, and avoiding clicking on Salesforce Tabs. It reduces issues with the selected app and the visible tabs in multiple orgs.
  • Remember that some commands without a text in the value/dataset column will not be executed, so they will not slow down the test case.
  • Remember the {!RUN_ID} variable can be used in value/dataset/apex columns. It is a random number per execution, and help ensure that the created records are unique.
  • Watch out for locators containing a Salesforce ID. Some pages use those ID's as part of the name of an element, and those might be different between Environments. Remember that you can manually choose another locator.
  • If you are testing a managed app before and after packaging, you can use the {!NS} variable to insert the namespace, configured in the Environment records.
  • If you do need to execute a command with a blank value ( to set a field as empty, for example ), you can use the {!BLANK} variable as the value.
  • If you know the page being tested is particularly slow, you can configure a complete Test Case to wait longer by inserting the command: copadoSetRetries <number of retries> <milliseconds between retries>. E.G. copadoSetRetries 50 1000 will try 50 times, waiting 1 second between tries, before failing a command.
  • You can reorder your test case commands, copy and paste rows/columns between test cases, or even from/to spreadsheets. Additional locators and other associated information will not be copied/pasted.
  • Developers can help greatly in testing, by assigning HTML labels to form fields, clear name attributes, and meaningful ID's.
  • Remember that this tool is geared towards Smoke Testing. It cannot replace Apex Testing, nor other forms of integration tests

How did we do?