Interaction

Select Click

Select an option in a select element.

Select an option in a select element.

Selects an option within a matched select element, either by value/index (REST/Magic/Puppeteer) or by a select-click behavior such as random or sequential selection (GPAL).

Examples

GPAL Fluent: High-level fluent C# API

//SelectClickType also supports LeftClick, SelectNext, SelectNextWithWrap, SelectPrevious, and SelectPreviousWithWrap.

browser.WithSelector(dropdownSelector).SelectClick(SelectClickType.SelectRandom);

MagicHelper: MagicHelper utility library

//Internally dispatches to WithSelectValue or WithSelectIndex depending on whether a string or numeric value is passed.

GPAL.MagicHelper.SelectClick("dropdown123", "option2"); // or select by index GPAL.MagicHelper.SelectClick("dropdown123", 1);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.SelectClick(elementHandle).WithSelectValue("option2").Execute(); // or select by index browser.PuppeteerClient.SelectClick(elementHandle).WithSelectIndex(1).Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.SelectByValue(elementHandle, "option2", sessionId); // or select by index await browser.PuppeteerCommunicator.SelectByIndex(elementHandle, 1, sessionId);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.SelectClick).WithElementId(dropdownSelector).WithSelectValue("option2").Execute();