Rayrun
← Back to Discord Forum

Salesforce app - dropdown selection

Hi - i am automating salesforce app and there is a pop up as below. Once clicking on edit, we could see dropdown on element and upon clicking , it expands to options. With inspect, I couldnt find any select or dropdown element to it instead i see as <input c-icbinfotablecell readonly>

Basically I am iterating through the rows and based of nth(index) - clicking and then trying to select options

Appreciate your quick response

IMG_0372.jpg
IMG_0373.jpg

This thread is trying to answer question "How to select options from a dropdown in a Salesforce app using automation?"

11 replies

@sabu9 you can try filter method filter hasText method can solve your issue

I am able to get until getByRole(‘combobox’). Please let me know how to select options here . With filter( {hasText:’1-Lead’}) didn work. Dropdown is isolated

IMG_0374.jpg

@refactoreric your help needed

Have you tried codegen to generate a selector?

@sabu9 you need click method after filter fiter({hasText:'text').click()

It generates until clicking dropdown, but not for dropdown options selection.

Still doesnt work. I tried retrieving textContent from dropdown and it logs as

1-Lead2-Important3- Transactional/Minor4-New/Investment5- N/A

refactoreric

@sabu9 What does innerHTML return on the dropdown after clicking it open?

I get the below. This shows the dropdown values of Gold, Silver, Bronze and 4-Unclassed

IMG_0386.jpg
refactoreric

OK, so the real dropdown is a child element of what you so far identified as "the dropdown". Maybe something like this will bring you further:

const selectElement = dropdownComponent.locator('select');
await selectElement.selectOption({label:’1-Lead’});

Awesome @refactoreric worked like a charm

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.