Skip to content

Unable to select dropdown/option(picklist) on Salesforce Flexipage #2715

@bhattaraiachyutkumar4-stack

Description

I am unable to select a dropdown option within a Salesforce Lightning Web Component (LWC) using standard Karate UI automation commands. The issue persists even after trying different locator strategies, including XPath, CSS selectors, and direct JavaScript execution. This suggests a potential issue with how Karate's driver handles specific DOM structures common in Salesforce's LWC framework.

Environment:

  • Karate version: 1.5.0
  • Browser: Chrome, latest

In Main Feature File: (I am providing full xpath from the root of the popup that appears which has the picklist)

* def targetValue = 'requestor_type_picklist.Customer'
Then call selectDropDown { fullXpathDrop: "//lightning-flow[@class='screen-flow']//section//flowruntime-flow//flowruntime-lwc-body//div[@class='flowruntimeBody flowruntimeBody__lwc slds-card__body slds-p-horizontal_small']//flowruntime-list-container//div//flowruntime-base-section//div//flowruntime-screen-field[@role='listitem']//flowruntime-lwc-field[@class='field-element']//div/flowruntime-picklist-input-lwc//div//lightning-select//div//div//select", targetValue: targetValue }

Helper Feature File (selectDropDown.feature) - All attempts failed:

Attempt 1: Standard select() with waitFor

* retry(10, 1000).waitFor(fullXpathDrop)
* select(fullXpathDrop, targetValue)
* retry(10, 1000).waitFor(fullXpathDrop + "[@value='" + targetValue + "']")

Attempt 2: Direct JavaScript with document.evaluate

Expected Behavior:

  • The dropdown option should be selected, and the test should pass.

Actual Behavior:

  • The test fails with a timeout error, indicating the select command or direct JavaScript manipulation did not successfully change the dropdown's value within the specified time. This failure happens consistently across all methods attempted.

Additional Information:

  • The page is a standard Salesforce LWC-based flow screen.

Tech Call Out:

Similar approach was working when we have Aura dropdwon on salesforce, a diffrent module has Aura dropdown which has same options on the drop down and it is working.

  • The Aura dropdown needs clicks ({div/a}, {li/a}) to simulate user interaction; it works fine
  • The LWC dropdown is a real → Karate supports .select() directly; it is not working

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions