SelectOptionAsync

Parent Previous Next

SelectOptionAsync

Description: the method selects an option from the select element by the specified index, text, or value

Syntax: SelectOptionAsync(string by, string locator, string type, string value)

Return value: no return value


Example:

FRAMEElement frame = await tester.GetFrameAsync(0);

await frame.SelectOptionAsync(Tester.BY_CSS, "#MySelect", FRAMEElement.BY_INDEX, "2");

await frame.SelectOptionAsync(Tester.BY_CSS, "#MySelect", FRAMEElement.BY_VALUE, "Mobile");

await frame.SelectOptionAsync(Tester.BY_CSS, "#MySelect", FRAMEElement.BY_TEXT, "Other");


await frame.SelectOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_INDEX, "2");

await frame.SelectOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_VALUE, "Mobile");

await frame.SelectOptionAsync(Tester.BY_XPATH, "//*[@id='MySelect']", FRAMEElement.BY_TEXT, "Other");

Created with the Personal Edition of HelpNDoc: Create HTML Help, DOC, PDF and print manuals from 1 single source