Best Playwright-dotnet code snippet using Microsoft.Playwright.LocatorSelectOptionOptions
ILocator.cs
Source:ILocator.cs  
...537        /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.538        /// Option is considered matching if all specified properties match.539        /// </param>540        /// <param name="options">Call options</param>541        Task<IReadOnlyList<string>> SelectOptionAsync(string values, LocatorSelectOptionOptions? options = default);542        /// <summary>543        /// <para>544        /// This method waits for <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>545        /// checks, waits until all specified options are present in the <c><select></c>546        /// element and selects these options.547        /// </para>548        /// <para>549        /// If the target element is not a <c><select></c> element, this method throws550        /// an error. However, if the element is inside the <c><label></c> element that551        /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,552        /// the control will be used instead.553        /// </para>554        /// <para>Returns the array of option values that have been successfully selected.</para>555        /// <para>556        /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have557        /// been selected.558        /// </para>559        /// <code>560        /// // single selection matching the value<br/>561        /// await element.SelectOptionAsync(new[] { "blue" });<br/>562        /// // single selection matching the label<br/>563        /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>564        /// // multiple selection<br/>565        /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>566        /// // multiple selection for blue, red and second option<br/>567        /// await element.SelectOptionAsync(new[] {<br/>568        ///     new SelectOptionValue() { Label = "blue" },<br/>569        ///     new SelectOptionValue() { Index = 2 },<br/>570        ///     new SelectOptionValue() { Value = "red" }});571        /// </code>572        /// </summary>573        /// <param name="values">574        /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,575        /// all matching options are selected, otherwise only the first option matching one576        /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.577        /// Option is considered matching if all specified properties match.578        /// </param>579        /// <param name="options">Call options</param>580        Task<IReadOnlyList<string>> SelectOptionAsync(IElementHandle values, LocatorSelectOptionOptions? options = default);581        /// <summary>582        /// <para>583        /// This method waits for <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>584        /// checks, waits until all specified options are present in the <c><select></c>585        /// element and selects these options.586        /// </para>587        /// <para>588        /// If the target element is not a <c><select></c> element, this method throws589        /// an error. However, if the element is inside the <c><label></c> element that590        /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,591        /// the control will be used instead.592        /// </para>593        /// <para>Returns the array of option values that have been successfully selected.</para>594        /// <para>595        /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have596        /// been selected.597        /// </para>598        /// <code>599        /// // single selection matching the value<br/>600        /// await element.SelectOptionAsync(new[] { "blue" });<br/>601        /// // single selection matching the label<br/>602        /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>603        /// // multiple selection<br/>604        /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>605        /// // multiple selection for blue, red and second option<br/>606        /// await element.SelectOptionAsync(new[] {<br/>607        ///     new SelectOptionValue() { Label = "blue" },<br/>608        ///     new SelectOptionValue() { Index = 2 },<br/>609        ///     new SelectOptionValue() { Value = "red" }});610        /// </code>611        /// </summary>612        /// <param name="values">613        /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,614        /// all matching options are selected, otherwise only the first option matching one615        /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.616        /// Option is considered matching if all specified properties match.617        /// </param>618        /// <param name="options">Call options</param>619        Task<IReadOnlyList<string>> SelectOptionAsync(IEnumerable<string> values, LocatorSelectOptionOptions? options = default);620        /// <summary>621        /// <para>622        /// This method waits for <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>623        /// checks, waits until all specified options are present in the <c><select></c>624        /// element and selects these options.625        /// </para>626        /// <para>627        /// If the target element is not a <c><select></c> element, this method throws628        /// an error. However, if the element is inside the <c><label></c> element that629        /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,630        /// the control will be used instead.631        /// </para>632        /// <para>Returns the array of option values that have been successfully selected.</para>633        /// <para>634        /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have635        /// been selected.636        /// </para>637        /// <code>638        /// // single selection matching the value<br/>639        /// await element.SelectOptionAsync(new[] { "blue" });<br/>640        /// // single selection matching the label<br/>641        /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>642        /// // multiple selection<br/>643        /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>644        /// // multiple selection for blue, red and second option<br/>645        /// await element.SelectOptionAsync(new[] {<br/>646        ///     new SelectOptionValue() { Label = "blue" },<br/>647        ///     new SelectOptionValue() { Index = 2 },<br/>648        ///     new SelectOptionValue() { Value = "red" }});649        /// </code>650        /// </summary>651        /// <param name="values">652        /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,653        /// all matching options are selected, otherwise only the first option matching one654        /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.655        /// Option is considered matching if all specified properties match.656        /// </param>657        /// <param name="options">Call options</param>658        Task<IReadOnlyList<string>> SelectOptionAsync(SelectOptionValue values, LocatorSelectOptionOptions? options = default);659        /// <summary>660        /// <para>661        /// This method waits for <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>662        /// checks, waits until all specified options are present in the <c><select></c>663        /// element and selects these options.664        /// </para>665        /// <para>666        /// If the target element is not a <c><select></c> element, this method throws667        /// an error. However, if the element is inside the <c><label></c> element that668        /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,669        /// the control will be used instead.670        /// </para>671        /// <para>Returns the array of option values that have been successfully selected.</para>672        /// <para>673        /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have674        /// been selected.675        /// </para>676        /// <code>677        /// // single selection matching the value<br/>678        /// await element.SelectOptionAsync(new[] { "blue" });<br/>679        /// // single selection matching the label<br/>680        /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>681        /// // multiple selection<br/>682        /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>683        /// // multiple selection for blue, red and second option<br/>684        /// await element.SelectOptionAsync(new[] {<br/>685        ///     new SelectOptionValue() { Label = "blue" },<br/>686        ///     new SelectOptionValue() { Index = 2 },<br/>687        ///     new SelectOptionValue() { Value = "red" }});688        /// </code>689        /// </summary>690        /// <param name="values">691        /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,692        /// all matching options are selected, otherwise only the first option matching one693        /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.694        /// Option is considered matching if all specified properties match.695        /// </param>696        /// <param name="options">Call options</param>697        Task<IReadOnlyList<string>> SelectOptionAsync(IEnumerable<IElementHandle> values, LocatorSelectOptionOptions? options = default);698        /// <summary>699        /// <para>700        /// This method waits for <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>701        /// checks, waits until all specified options are present in the <c><select></c>702        /// element and selects these options.703        /// </para>704        /// <para>705        /// If the target element is not a <c><select></c> element, this method throws706        /// an error. However, if the element is inside the <c><label></c> element that707        /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,708        /// the control will be used instead.709        /// </para>710        /// <para>Returns the array of option values that have been successfully selected.</para>711        /// <para>712        /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have713        /// been selected.714        /// </para>715        /// <code>716        /// // single selection matching the value<br/>717        /// await element.SelectOptionAsync(new[] { "blue" });<br/>718        /// // single selection matching the label<br/>719        /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>720        /// // multiple selection<br/>721        /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>722        /// // multiple selection for blue, red and second option<br/>723        /// await element.SelectOptionAsync(new[] {<br/>724        ///     new SelectOptionValue() { Label = "blue" },<br/>725        ///     new SelectOptionValue() { Index = 2 },<br/>726        ///     new SelectOptionValue() { Value = "red" }});727        /// </code>728        /// </summary>729        /// <param name="values">730        /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,731        /// all matching options are selected, otherwise only the first option matching one732        /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.733        /// Option is considered matching if all specified properties match.734        /// </param>735        /// <param name="options">Call options</param>736        Task<IReadOnlyList<string>> SelectOptionAsync(IEnumerable<SelectOptionValue> values, LocatorSelectOptionOptions? options = default);737        /// <summary>738        /// <para>739        /// This method waits for <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>740        /// checks, then focuses the element and selects all its text content.741        /// </para>742        /// </summary>743        /// <param name="options">Call options</param>744        Task SelectTextAsync(LocatorSelectTextOptions? options = default);745        /// <summary>746        /// <para>This method checks or unchecks an element by performing the following steps:</para>747        /// <list type="ordinal">748        /// <item><description>749        /// Ensure that matched element is a checkbox or a radio input. If not, this method750        /// throws....LocatorSynchronous.cs
Source:LocatorSynchronous.cs  
...415    /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.416    /// Option is considered matching if all specified properties match.417    /// </param>418    /// <param name="options">Call options</param>419    public static IReadOnlyList<string> SelectOption(this ILocator locator, string values, LocatorSelectOptionOptions? options = null)420    {421        return locator.SelectOptionAsync(values, options).GetAwaiter().GetResult();422    }423    /// <summary>424    /// <para>425    /// This method waits for <a href="./actionability.md">actionability</a> checks, waits426    /// until all specified options are present in the <c><select></c> element and427    /// selects these options.428    /// </para>429    /// <para>430    /// If the target element is not a <c><select></c> element, this method throws431    /// an error. However, if the element is inside the <c><label></c> element that432    /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,433    /// the control will be used instead.434    /// </para>435    /// <para>Returns the array of option values that have been successfully selected.</para>436    /// <para>437    /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have438    /// been selected.439    /// </para>440    /// <code>441    /// // single selection matching the value<br/>442    /// await element.SelectOptionAsync(new[] { "blue" });<br/>443    /// // single selection matching the label<br/>444    /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>445    /// // multiple selection<br/>446    /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>447    /// // multiple selection for blue, red and second option<br/>448    /// await element.SelectOptionAsync(new[] {<br/>449    ///     new SelectOptionValue() { Label = "blue" },<br/>450    ///     new SelectOptionValue() { Index = 2 },<br/>451    ///     new SelectOptionValue() { Value = "red" }});452    /// </code>453    /// </summary>454    /// <param name="values">455    /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,456    /// all matching options are selected, otherwise only the first option matching one457    /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.458    /// Option is considered matching if all specified properties match.459    /// </param>460    /// <param name="options">Call options</param>461    public static IReadOnlyList<string> SelectOption(this ILocator locator, IElementHandle values, LocatorSelectOptionOptions? options = null)462    {463        return locator.SelectOptionAsync(values, options).GetAwaiter().GetResult();464    }465    /// <summary>466    /// <para>467    /// This method waits for <a href="./actionability.md">actionability</a> checks, waits468    /// until all specified options are present in the <c><select></c> element and469    /// selects these options.470    /// </para>471    /// <para>472    /// If the target element is not a <c><select></c> element, this method throws473    /// an error. However, if the element is inside the <c><label></c> element that474    /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,475    /// the control will be used instead.476    /// </para>477    /// <para>Returns the array of option values that have been successfully selected.</para>478    /// <para>479    /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have480    /// been selected.481    /// </para>482    /// <code>483    /// // single selection matching the value<br/>484    /// await element.SelectOptionAsync(new[] { "blue" });<br/>485    /// // single selection matching the label<br/>486    /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>487    /// // multiple selection<br/>488    /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>489    /// // multiple selection for blue, red and second option<br/>490    /// await element.SelectOptionAsync(new[] {<br/>491    ///     new SelectOptionValue() { Label = "blue" },<br/>492    ///     new SelectOptionValue() { Index = 2 },<br/>493    ///     new SelectOptionValue() { Value = "red" }});494    /// </code>495    /// </summary>496    /// <param name="values">497    /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,498    /// all matching options are selected, otherwise only the first option matching one499    /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.500    /// Option is considered matching if all specified properties match.501    /// </param>502    /// <param name="options">Call options</param>503    public static IReadOnlyList<string> SelectOption(this ILocator locator, IEnumerable<string> values, LocatorSelectOptionOptions? options = null)504    {505        return locator.SelectOptionAsync(values, options).GetAwaiter().GetResult();506    }507    /// <summary>508    /// <para>509    /// This method waits for <a href="./actionability.md">actionability</a> checks, waits510    /// until all specified options are present in the <c><select></c> element and511    /// selects these options.512    /// </para>513    /// <para>514    /// If the target element is not a <c><select></c> element, this method throws515    /// an error. However, if the element is inside the <c><label></c> element that516    /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,517    /// the control will be used instead.518    /// </para>519    /// <para>Returns the array of option values that have been successfully selected.</para>520    /// <para>521    /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have522    /// been selected.523    /// </para>524    /// <code>525    /// // single selection matching the value<br/>526    /// await element.SelectOptionAsync(new[] { "blue" });<br/>527    /// // single selection matching the label<br/>528    /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>529    /// // multiple selection<br/>530    /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>531    /// // multiple selection for blue, red and second option<br/>532    /// await element.SelectOptionAsync(new[] {<br/>533    ///     new SelectOptionValue() { Label = "blue" },<br/>534    ///     new SelectOptionValue() { Index = 2 },<br/>535    ///     new SelectOptionValue() { Value = "red" }});536    /// </code>537    /// </summary>538    /// <param name="values">539    /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,540    /// all matching options are selected, otherwise only the first option matching one541    /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.542    /// Option is considered matching if all specified properties match.543    /// </param>544    /// <param name="options">Call options</param>545    public static IReadOnlyList<string> SelectOption(this ILocator locator, SelectOptionValue values, LocatorSelectOptionOptions? options = null)546    {547        return locator.SelectOptionAsync(values, options).GetAwaiter().GetResult();548    }549    /// <summary>550    /// <para>551    /// This method waits for <a href="./actionability.md">actionability</a> checks, waits552    /// until all specified options are present in the <c><select></c> element and553    /// selects these options.554    /// </para>555    /// <para>556    /// If the target element is not a <c><select></c> element, this method throws557    /// an error. However, if the element is inside the <c><label></c> element that558    /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,559    /// the control will be used instead.560    /// </para>561    /// <para>Returns the array of option values that have been successfully selected.</para>562    /// <para>563    /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have564    /// been selected.565    /// </para>566    /// <code>567    /// // single selection matching the value<br/>568    /// await element.SelectOptionAsync(new[] { "blue" });<br/>569    /// // single selection matching the label<br/>570    /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>571    /// // multiple selection<br/>572    /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>573    /// // multiple selection for blue, red and second option<br/>574    /// await element.SelectOptionAsync(new[] {<br/>575    ///     new SelectOptionValue() { Label = "blue" },<br/>576    ///     new SelectOptionValue() { Index = 2 },<br/>577    ///     new SelectOptionValue() { Value = "red" }});578    /// </code>579    /// </summary>580    /// <param name="values">581    /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,582    /// all matching options are selected, otherwise only the first option matching one583    /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.584    /// Option is considered matching if all specified properties match.585    /// </param>586    /// <param name="options">Call options</param>587    public static IReadOnlyList<string> SelectOption(this ILocator locator, IEnumerable<IElementHandle> values, LocatorSelectOptionOptions? options = null)588    {589        return locator.SelectOptionAsync(values, options).GetAwaiter().GetResult();590    }591    /// <summary>592    /// <para>593    /// This method waits for <a href="./actionability.md">actionability</a> checks, waits594    /// until all specified options are present in the <c><select></c> element and595    /// selects these options.596    /// </para>597    /// <para>598    /// If the target element is not a <c><select></c> element, this method throws599    /// an error. However, if the element is inside the <c><label></c> element that600    /// has an associated <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>,601    /// the control will be used instead.602    /// </para>603    /// <para>Returns the array of option values that have been successfully selected.</para>604    /// <para>605    /// Triggers a <c>change</c> and <c>input</c> event once all the provided options have606    /// been selected.607    /// </para>608    /// <code>609    /// // single selection matching the value<br/>610    /// await element.SelectOptionAsync(new[] { "blue" });<br/>611    /// // single selection matching the label<br/>612    /// await element.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });<br/>613    /// // multiple selection<br/>614    /// await element.SelectOptionAsync(new[] { "red", "green", "blue" });<br/>615    /// // multiple selection for blue, red and second option<br/>616    /// await element.SelectOptionAsync(new[] {<br/>617    ///     new SelectOptionValue() { Label = "blue" },<br/>618    ///     new SelectOptionValue() { Index = 2 },<br/>619    ///     new SelectOptionValue() { Value = "red" }});620    /// </code>621    /// </summary>622    /// <param name="values">623    /// Options to select. If the <c><select></c> has the <c>multiple</c> attribute,624    /// all matching options are selected, otherwise only the first option matching one625    /// of the passed options is selected. String values are equivalent to <c>{value:'string'}</c>.626    /// Option is considered matching if all specified properties match.627    /// </param>628    /// <param name="options">Call options</param>629    public static IReadOnlyList<string> SelectOption(this ILocator locator, IEnumerable<SelectOptionValue> values, LocatorSelectOptionOptions? options = null)630    {631        return locator.SelectOptionAsync(values, options).GetAwaiter().GetResult();632    }633    /// <summary>634    /// <para>635    /// This method expects <c>element</c> to point to an <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input636    /// element</a>.637    /// </para>638    /// <para>639    /// Sets the value of the file input to these file paths or files. If some of the <c>filePaths</c>640    /// are relative paths, then they are resolved relative to the the current working directory.641    /// For empty array, clears the selected files.642    /// </para>643    /// </summary>...Locator.cs
Source:Locator.cs  
...153        public Task<byte[]> ScreenshotAsync(LocatorScreenshotOptions options = null)154            => WithElementAsync(async (h, o) => await h.ScreenshotAsync(ConvertOptions<ElementHandleScreenshotOptions>(o)).ConfigureAwait(false), options);155        public Task ScrollIntoViewIfNeededAsync(LocatorScrollIntoViewIfNeededOptions options = null)156            => WithElementAsync(async (h, o) => await h.ScrollIntoViewIfNeededAsync(ConvertOptions<ElementHandleScrollIntoViewIfNeededOptions>(o)).ConfigureAwait(false), options);157        public Task<IReadOnlyList<string>> SelectOptionAsync(string values, LocatorSelectOptionOptions options = null)158            => _frame.SelectOptionAsync(_selector, values, ConvertOptions<FrameSelectOptionOptions>(options));159        public Task<IReadOnlyList<string>> SelectOptionAsync(IElementHandle values, LocatorSelectOptionOptions options = null)160            => _frame.SelectOptionAsync(_selector, values, ConvertOptions<FrameSelectOptionOptions>(options));161        public Task<IReadOnlyList<string>> SelectOptionAsync(IEnumerable<string> values, LocatorSelectOptionOptions options = null)162            => _frame.SelectOptionAsync(_selector, values, ConvertOptions<FrameSelectOptionOptions>(options));163        public Task<IReadOnlyList<string>> SelectOptionAsync(SelectOptionValue values, LocatorSelectOptionOptions options = null)164            => _frame.SelectOptionAsync(_selector, values, ConvertOptions<FrameSelectOptionOptions>(options));165        public Task<IReadOnlyList<string>> SelectOptionAsync(IEnumerable<IElementHandle> values, LocatorSelectOptionOptions options = null)166            => _frame.SelectOptionAsync(_selector, values, ConvertOptions<FrameSelectOptionOptions>(options));167        public Task<IReadOnlyList<string>> SelectOptionAsync(IEnumerable<SelectOptionValue> values, LocatorSelectOptionOptions options = null)168            => _frame.SelectOptionAsync(_selector, values, ConvertOptions<FrameSelectOptionOptions>(options));169        public Task SelectTextAsync(LocatorSelectTextOptions options = null)170            => WithElementAsync((h, o) => h.SelectTextAsync(ConvertOptions<ElementHandleSelectTextOptions>(o)), options);171        public Task SetInputFilesAsync(string files, LocatorSetInputFilesOptions options = null)172            => _frame.SetInputFilesAsync(_selector, files, ConvertOptions<FrameSetInputFilesOptions>(options));173        public Task SetInputFilesAsync(IEnumerable<string> files, LocatorSetInputFilesOptions options = null)174            => _frame.SetInputFilesAsync(_selector, files, ConvertOptions<FrameSetInputFilesOptions>(options));175        public Task SetInputFilesAsync(FilePayload files, LocatorSetInputFilesOptions options = null)176            => _frame.SetInputFilesAsync(_selector, files, ConvertOptions<FrameSetInputFilesOptions>(options));177        public Task SetInputFilesAsync(IEnumerable<FilePayload> files, LocatorSetInputFilesOptions options = null)178            => _frame.SetInputFilesAsync(_selector, files, ConvertOptions<FrameSetInputFilesOptions>(options));179        public Task TapAsync(LocatorTapOptions options = null)180            => _frame.TapAsync(_selector, ConvertOptions<FrameTapOptions>(options));181        public Task<string> TextContentAsync(LocatorTextContentOptions options = null)...PlaywrightSyncElement.cs
Source:PlaywrightSyncElement.cs  
...262            {263                return false;264            }265        }266        /// <inheritdoc cref = "ILocator.SelectOptionAsync(IElementHandle, LocatorSelectOptionOptions)"  />267        public IReadOnlyList<string> SelectOption(IElementHandle values, LocatorSelectOptionOptions? options = null)268        {269            return ElementLocator().SelectOptionAsync(values, options).Result;270        }271        /// <inheritdoc cref = "ILocator.SelectOptionAsync(IEnumerable{IElementHandle}, LocatorSelectOptionOptions)"  />272        public IReadOnlyList<string> SelectOption(IEnumerable<IElementHandle> values, LocatorSelectOptionOptions? options = null)273        {274            return ElementLocator().SelectOptionAsync(values, options).Result;275        }276        /// <inheritdoc cref = "ILocator.SelectOptionAsync(IEnumerable{SelectOptionValue}, LocatorSelectOptionOptions)"  />277        public IReadOnlyList<string> SelectOption(IEnumerable<SelectOptionValue> values, LocatorSelectOptionOptions? options = null)278        {279            return ElementLocator().SelectOptionAsync(values, options).Result;280        }281        /// <inheritdoc cref = "ILocator.SelectOptionAsync(IEnumerable{string}, LocatorSelectOptionOptions)"  />282        public IReadOnlyList<string> SelectOption(IEnumerable<string> values, LocatorSelectOptionOptions? options = null)283        {284            return ElementLocator().SelectOptionAsync(values, options).Result;285        }286        /// <inheritdoc cref = "ILocator.SelectOptionAsync(SelectOptionValue, LocatorSelectOptionOptions)"  />287        public IReadOnlyList<string> SelectOption(SelectOptionValue values, LocatorSelectOptionOptions? options = null)288        {289            return ElementLocator().SelectOptionAsync(values, options).Result;290        }291        /// <inheritdoc cref = "ILocator.SelectOptionAsync(string, LocatorSelectOptionOptions)"  />292        public IReadOnlyList<string> SelectOption(string values, LocatorSelectOptionOptions? options = null)293        {294            return ElementLocator().SelectOptionAsync(values, options).Result;295        }296        /// <inheritdoc cref = "ILocator.EvaluateAllAsync"  />297        public T EvaluateAll<T>(string expression, object? arg = null)298        {299            return ElementLocator().EvaluateAllAsync<T>(expression, arg).Result;300        }301        /// <inheritdoc cref = "ILocator.EvaluateAsync"  />302        public JsonElement? Evaluate(string expression, object? arg = null)303        {304            return ElementLocator().EvaluateAsync(expression, arg).Result;305        }306        /// <inheritdoc cref = "ILocator.GetAttributeAsync"  />...LocatorSelectOptionOptions.cs
Source:LocatorSelectOptionOptions.cs  
...35using System.Threading.Tasks;36#nullable enable37namespace Microsoft.Playwright38{39    public class LocatorSelectOptionOptions40    {41        public LocatorSelectOptionOptions() { }42        public LocatorSelectOptionOptions(LocatorSelectOptionOptions clone)43        {44            if (clone == null)45            {46                return;47            }48            Force = clone.Force;49            NoWaitAfter = clone.NoWaitAfter;50            Timeout = clone.Timeout;51        }52        /// <summary>53        /// <para>54        /// Whether to bypass the <a href="https://playwright.dev/dotnet/docs/actionability">actionability</a>55        /// checks. Defaults to <c>false</c>.56        /// </para>...LocatorSelectOptionOptions
Using AI Code Generation
1using Microsoft.Playwright;2using System;3using System.Threading.Tasks;4{5    {6        static async Task Main(string[] args)7        {8            using var playwright = await Playwright.CreateAsync();9            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions10            {11            });12            var page = await browser.NewPageAsync();13            await page.WaitForLoadStateAsync();14            await page.ClickAsync("input[name=\"q\"]");15            await page.TypeAsync("input[name=\"q\"]", "Hello World");16            await page.ClickAsync("text=Google Search");17            await page.WaitForLoadStateAsync();18            await page.ClickAsync("text=Images");19            await page.WaitForLoadStateAsync();20            await page.ClickAsync("text=All");21            await page.WaitForLoadStateAsync();22            await page.ClickAsync("text=Images");23            await page.WaitForLoadStateAsync();24            await page.ClickAsync("text=All");25            await page.WaitForLoadStateAsync();26            await page.ClickAsync("text=Images");27            await page.WaitForLoadStateAsync();28            await page.ClickAsync("text=All");29            await page.WaitForLoadStateAsync();30            await page.ClickAsync("text=Images");31            await page.WaitForLoadStateAsync();32            await page.ClickAsync("text=All");33            await page.WaitForLoadStateAsync();34            await page.ClickAsync("text=Images");35            await page.WaitForLoadStateAsync();36            await page.ClickAsync("text=All");37            await page.WaitForLoadStateAsync();38            await page.ClickAsync("text=Images");39            await page.WaitForLoadStateAsync();40            await page.ClickAsync("text=All");41            await page.WaitForLoadStateAsync();42            await page.ClickAsync("text=Images");43            await page.WaitForLoadStateAsync();44            await page.ClickAsync("text=All");45            await page.WaitForLoadStateAsync();46            await page.ClickAsync("text=Images");47            await page.WaitForLoadStateAsync();48            await page.ClickAsync("text=All");49            await page.WaitForLoadStateAsync();50            await page.ClickAsync("text=Images");51            await page.WaitForLoadStateAsync();52            await page.ClickAsync("text=All");53            await page.WaitForLoadStateAsync();54            await page.ClickAsync("text=Images");55            await page.WaitForLoadStateAsync();LocatorSelectOptionOptions
Using AI Code Generation
1using Microsoft.Playwright;2using System;3using System.Threading.Tasks;4{5    {6        static async Task Main(string[] args)7        {8            await using var playwright = await Playwright.CreateAsync();9            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions10            {11            });12            var page = await browser.NewPageAsync();13            await page.TypeAsync("input[title='Search']", "Hello World");14            await page.ClickAsync("input[value='Google Search']");15            await page.ClickAsync("text=Images");16            var locator = page.Locator("text=Images", new LocatorSelectOptionOptionsLocatorSelectOptionOptions
Using AI Code Generation
1using Microsoft.Playwright;2using System.Threading.Tasks;3{4    {5        public string[] Value { get; set; }6        public string[] Label { get; set; }7        public string[] Index { get; set; }8    }9    {10        public static async Task Main(string[] args)11        {12            await using var playwright = await Playwright.CreateAsync();13            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions14            {15            });16            var page = await browser.NewPageAsync();17            await page.ClickAsync("text=Select a car");18            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions19            {20                Label = new[] { "Volvo" }21            });22        }23    }24}LocatorSelectOptionOptions
Using AI Code Generation
1using Microsoft.Playwright;2using Microsoft.Playwright.NUnit;3using NUnit.Framework;4using System;5using System.Threading.Tasks;6{7    {8        public async Task TestMethod()9        {10            using var playwright = await Playwright.CreateAsync();11            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions12            {13            });14            var page = await browser.NewPageAsync();LocatorSelectOptionOptions
Using AI Code Generation
1using Microsoft.Playwright;2using System;3using System.Collections.Generic;4using System.Linq;5using System.Text;6using System.Threading.Tasks;7{8    {9        static async Task Main(string[] args)10        {11            using var playwright = await Playwright.CreateAsync();12            await using var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions13            {14            });15            var context = await browser.NewContextAsync();16            var page = await context.NewPageAsync();17            await page.ClickAsync("#iframeResult");18            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions19            {20            });21            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions22            {23            });24            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions25            {26            });27            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions28            {29            });30            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions31            {32            });33            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions34            {35            });36            await page.SelectOptionAsync("select", new LocatorSelectOptionOptions37            {LocatorSelectOptionOptions
Using AI Code Generation
1var options = new LocatorSelectOptionOptions();2options.SetLabel("Option 1");3await Page.QuerySelectorAsync("select").SelectOptionAsync(options);4var options = new LocatorSelectOptionOptions();5options.SetLabel("Option 1");6await Page.QuerySelectorAsync("select").SelectOptionAsync(options);7var options = new LocatorSelectOptionOptions();8options.SetLabel("Option 1");9await Page.QuerySelectorAsync("select").SelectOptionAsync(options);10var options = new LocatorSelectOptionOptions();11options.SetLabel("Option 1");12await Page.QuerySelectorAsync("select").SelectOptionAsync(options);13var options = new LocatorSelectOptionOptions();14options.SetLabel("Option 1");15await Page.QuerySelectorAsync("select").SelectOptionAsync(options);16var options = new LocatorSelectOptionOptions();17options.SetLabel("Option 1");18await Page.QuerySelectorAsync("select").SelectOptionAsync(options);LocatorSelectOptionOptions
Using AI Code Generation
1using System;2using System.Threading.Tasks;3using Microsoft.Playwright;4{5    {6        static async Task Main(string[] args)7        {8            await using var playwright = await Playwright.CreateAsync();9            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions10            {11            });12            var page = await browser.NewPageAsync();13            await page.ScreenshotAsync("1.png");14            var select = await page.QuerySelectorAsync("[name='language']");15            await select.SelectOptionAsync(new LocatorSelectOptionOptions16            {17            });18            await page.ScreenshotAsync("2.png");19        }20    }21}22using System;23using System.Threading.Tasks;24using Microsoft.Playwright;25{26    {27        static async Task Main(string[] args)28        {29            await using var playwright = await Playwright.CreateAsync();30            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions31            {32            });33            var page = await browser.NewPageAsync();34            await page.ScreenshotAsync("1.png");35            var select = await page.QuerySelectorAsync("[name='language']");36            await select.SelectOptionAsync(new LocatorSelectOptionOptions37            {38            });39            await page.ScreenshotAsync("2.png");40        }41    }42}43using System;44using System.Threading.Tasks;45using Microsoft.Playwright;46{47    {48        static async Task Main(string[] args)49        {LocatorSelectOptionOptions
Using AI Code Generation
1using System;2using System.Threading.Tasks;3using Microsoft.Playwright;4{5    {6        static async Task Main(string[] args)7        {8            using var playwright = await Playwright.CreateAsync();9            await using var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions { Headless = false });10            var context = await browser.NewContextAsync();11            var page = await context.NewPageAsync();12            var selectElement = await page.QuerySelectorAsync("#dropdown-class-example");13            await selectElement.SelectOptionAsync("Option2");14            await selectElement.SelectOptionAsync("option1");15            await selectElement.SelectOptionAsync(0);16            await selectElement.SelectOptionAsync(new LocatorSelectOptionOptions { Text = new[] { "Option2", "Option3" } });17            await selectElement.SelectOptionAsync(new LocatorSelectOptionOptions { Value = new[] { "option1", "option2" } });18            await selectElement.SelectOptionAsync(new LocatorSelectOptionOptions { Index = new[] { 0, 1 } });19        }20    }21}LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!
