Add "Get All Picklist Values" keyword for Lightning picklists#3986
Add "Get All Picklist Values" keyword for Lightning picklists#3986b-vamsipunnam wants to merge 4 commits into
Conversation
|
Thanks for the contribution! Before we can merge this, we need @b-vamsipunnam to sign the Salesforce Inc. Contributor License Agreement. |
I completed this Step
|
jstvz
left a comment
There was a problem hiding this comment.
Thanks for the contribution. A few issues to address:
Context: This module has not seen active locator or keyword development since API v56. If this lands, future maintenance would likely fall to contributors.
XPath injection
The picklist parameter is interpolated directly into XPath via f-strings:
f"normalize-space(.)='{picklist}' "A label containing a single quote (e.g. Customer's Status) breaks the XPath. Use concat() to handle arbitrary input safely, or at minimum escape quotes.
Empty-string inclusion
The test asserts values == ["Warm", "Cold", "Warm", ""]. The whitespace-only option " " strips to "" and is included in results. Consumers will almost always need to filter these. Consider:
text = element.text.strip()
if text:
values.append(text)Mock bleed between tests
TestKeywordGetAllPicklistValues uses a class-level cls.sflib instance but never resets mock state between tests. set_focus_to_element.side_effect = ElementNotFound() in test_raises_assertion_when_picklist_not_found persists into subsequent tests if execution order changes. Use setup_method to reset mocks or create a fresh instance per test.
Bypassed label infrastructure
CCI's robot library has an existing locator/label system (_init_locators, lex_locators). Building a parallel XPath-based label lookup creates a second maintenance surface. Consider whether the existing locator infrastructure can be extended for this use case.
|
Hi @jstvz , Thanks for the detailed review. I’ve updated the PR to address the feedback:
I also reran the unit tests, Robot test, Happy to make any additional updates or refinements if needed. Thank you. |

Summary
Adds a new Robot Framework keyword,
Get All Picklist Values, to the Salesforce library.This keyword makes it easier to retrieve the values currently rendered in Salesforce Lightning picklists directly from the UI.
Motivation
Salesforce Lightning picklists can change due to metadata deployments, admin updates, record type configurations, and environment-specific customization.
In many automation scenarios, validating picklist values currently requires brittle XPath assertions or hardcoded validation logic inside tests.
This keyword provides a reusable way to fetch Lightning picklist values directly from the UI, making validation simpler and easier to maintain.
Implementation
get_all_picklist_valuestocumulusci/robotframework/Salesforce.pyStage,*Stage,Stage *)Use Cases
This keyword helps simplify Salesforce Lightning picklist validation in UI automation scenarios where values may evolve over time.
Examples include:
Tests
Added Python unit tests covering:
Added a Robot Framework integration test validating:
Files Changed
AUTHORS.rstcumulusci/robotframework/Salesforce.pycumulusci/robotframework/tests/test_salesforce.pycumulusci/robotframework/tests/salesforce/picklist.robotExample