The selenium-sfdc
extension allows Selenium IDE tests to interact at a higher level with the Salesforce UI, and at a deeper level with the Salesforce API.
This repo is in rough development, and has plenty of areas for growth. If you would like to see improvements in this extension, please submit a pull request.
- Simplify IDE usage with high-level Salesforce commands
- Query field metadata to create more precise field selectors
- Query hidden data after users make an update from the UI
- Execute Unit tests as part of a Selenium test suite
- Generate core test records in a new sandbox (Account > Contact > Opportunity)
- Log into Salesforce as an admin user
- Navigate to
Setup > Build > Create > Apps
- Follow the instructions from Salesforce here and here to create a new Connected App.
- Provide the following details for your connected app:
Connected App Name
:selenium_ide
Description
:Salesforce REST APIs for the Selenium IDE
Enable OAuth Settings
:Checked
Selected OAuth Scope
:Full access (full)
- Open the Connected App and write down the values for
Consumer Key
andConsumer Secret
- Follow the instructions from Salesforce here to assign user access to the Connected App
- For the logging in user, write down the values for
Username
,Password
andSecurity Token
- Download the
selenium-sfdc
project repository. - Open the Selenium IDE and navigate to
Options > General > Selenium Core extensions (user-extensions.js) > Browse...
- Locate
selenium-sfdc.js
and clickOpen
- Restart the Selenium IDE
- For detailed API specifications, please open the Jasmine Test Runner (Local).
- For samples of API usage in Selenium, please open the [Selenium Test Suite](/Test Suite/Test Suite - Selenium for Salesforce.html) ([Local](/Users/isaac.lewis/repos/selenium/selenium-sfdc/Test Suite/Test Suite - Selenium for Salesforce.html)).
Command | Description |
---|---|
sfdc.util | |
sfdc.util.encodeParams | |
sfdc.util.printObject | |
sfdc.api | |
sfdc.api.callout | |
sfdc.api.login | |
sfdc.api.query | |
sfdc.api.toolingQuery | |
sfdc.api.describeSObject | |
sfdc.api.runTestsSynchronous | |
sfdc.ui |
Command | Description |
---|---|
sfdcLogin | |
sfdcLoginAsUser | |
sfdcLogoutAsUser | |
sfdcOpenHomeAndWait | |
sfdcOpenRecordAndWait | |
sfdcDescribePageLayout (ObjectName, RecordTypeName) | |
sfdcAssertButton | |
sfdcAssertField | |
sfdcAssertRelatedList | |
sfdcGetFieldMap | |
sfdcGetFieldValue | |
sfdcSetFieldValue | |
sfdcSetFieldRecordType | |
sfdcSetFieldLookup |
Command | Target | Value |
---|---|---|
store | CONNECTED_APP_CONSUMER_KEY |
client_id |
store | CONNECTED_APP_CONSUMER_SECRET |
client_secret |
store | user@email.com |
username |
store | P@SSW0RD |
password |
store | K2vgoIeiDBufPQNUVAAukwix |
security_token |
loginSFDC | ${username} | ${password}${security_token} |
Command | Target | Value |
---|---|---|
querySOQL | SELECT Id, Name FROM Account LIMIT 5 | accounts |
echo | javascript{storedVars['accounts'][0].Name} | - |
queryTooling | SELECT Id, DeveloperName FROM CustomField WHERE TableEnumOrId = 'Account' LIMIT 5 | account_fields |
echo | javascript{storedVars['account_fields'][0].Id} | - |
- Sample User Extension
- AJAX Selenium Extension
- Beginner's Guide to Building Selenium Extensions & Plugins
- http://blog.walty8.com/painful-selenium-part-4-firefox-screenshot/
- http://www.theautomatedtester.co.uk/tutorials/selenium/selenium_extension.htm
- http://agiletesting.blogspot.com/2006/03/ajax-testing-with-selenium-using_21.html
- http://www.sqaforums.com/forums/selenium/148586-how-use-user-extensions-javascript-selenium-webdriver.html
- Salesforce REST API Explorer (Workbench)
- Salesforce REST API Documentation
- Salesforce Tooling API Documentation
- Automated Testing with Salesforce and Selenium
- Selenium and Salesforce: Automation Testing Video Tutorial - Part 1