mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: align select options docs (#27097)
Fixes: https://github.com/microsoft/playwright/issues/27094
This commit is contained in:
parent
3170963f42
commit
c6510ac000
@ -777,7 +777,7 @@ Triggers a `change` and `input` event once all the provided options have been se
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
handle.selectOption('blue');
|
||||
|
||||
// single selection matching the label
|
||||
@ -788,7 +788,7 @@ handle.selectOption(['red', 'green', 'blue']);
|
||||
```
|
||||
|
||||
```java
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
handle.selectOption("blue");
|
||||
// single selection matching the label
|
||||
handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
@ -797,7 +797,7 @@ handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
```
|
||||
|
||||
```python async
|
||||
# single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
await handle.select_option("blue")
|
||||
# single selection matching the label
|
||||
await handle.select_option(label="blue")
|
||||
@ -806,7 +806,7 @@ await handle.select_option(value=["red", "green", "blue"])
|
||||
```
|
||||
|
||||
```python sync
|
||||
# single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
handle.select_option("blue")
|
||||
# single selection matching both the label
|
||||
handle.select_option(label="blue")
|
||||
@ -815,7 +815,7 @@ handle.select_option(value=["red", "green", "blue"])
|
||||
```
|
||||
|
||||
```csharp
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
await handle.SelectOptionAsync(new[] { "blue" });
|
||||
// single selection matching the label
|
||||
await handle.SelectOptionAsync(new[] { new SelectOptionValue() { Label = "blue" } });
|
||||
|
||||
@ -1486,7 +1486,7 @@ Triggers a `change` and `input` event once all the provided options have been se
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
frame.selectOption('select#colors', 'blue');
|
||||
|
||||
// single selection matching both the value and the label
|
||||
@ -1497,7 +1497,7 @@ frame.selectOption('select#colors', 'red', 'green', 'blue');
|
||||
```
|
||||
|
||||
```java
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
frame.selectOption("select#colors", "blue");
|
||||
// single selection matching both the value and the label
|
||||
frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
@ -1506,7 +1506,7 @@ frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
```
|
||||
|
||||
```python async
|
||||
# single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
await frame.select_option("select#colors", "blue")
|
||||
# single selection matching the label
|
||||
await frame.select_option("select#colors", label="blue")
|
||||
@ -1515,7 +1515,7 @@ await frame.select_option("select#colors", value=["red", "green", "blue"])
|
||||
```
|
||||
|
||||
```python sync
|
||||
# single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
frame.select_option("select#colors", "blue")
|
||||
# single selection matching both the label
|
||||
frame.select_option("select#colors", label="blue")
|
||||
@ -1524,7 +1524,7 @@ frame.select_option("select#colors", value=["red", "green", "blue"])
|
||||
```
|
||||
|
||||
```csharp
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
await frame.SelectOptionAsync("select#colors", new[] { "blue" });
|
||||
// single selection matching both the value and the label
|
||||
await frame.SelectOptionAsync("select#colors", new[] { new SelectOptionValue() { Label = "blue" } });
|
||||
|
||||
@ -3406,7 +3406,7 @@ Triggers a `change` and `input` event once all the provided options have been se
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
page.selectOption('select#colors', 'blue');
|
||||
|
||||
// single selection matching the label
|
||||
@ -3418,7 +3418,7 @@ page.selectOption('select#colors', ['red', 'green', 'blue']);
|
||||
```
|
||||
|
||||
```java
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
page.selectOption("select#colors", "blue");
|
||||
// single selection matching both the value and the label
|
||||
page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
@ -3427,7 +3427,7 @@ page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
```
|
||||
|
||||
```python async
|
||||
# single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
await page.select_option("select#colors", "blue")
|
||||
# single selection matching the label
|
||||
await page.select_option("select#colors", label="blue")
|
||||
@ -3436,7 +3436,7 @@ await page.select_option("select#colors", value=["red", "green", "blue"])
|
||||
```
|
||||
|
||||
```python sync
|
||||
# single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
page.select_option("select#colors", "blue")
|
||||
# single selection matching both the label
|
||||
page.select_option("select#colors", label="blue")
|
||||
@ -3445,7 +3445,7 @@ page.select_option("select#colors", value=["red", "green", "blue"])
|
||||
```
|
||||
|
||||
```csharp
|
||||
// single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
await page.SelectOptionAsync("select#colors", new[] { "blue" });
|
||||
// single selection matching both the value and the label
|
||||
await page.SelectOptionAsync("select#colors", new[] { new SelectOptionValue() { Label = "blue" } });
|
||||
|
||||
@ -144,7 +144,7 @@ Selects one or multiple options in the `<select>` element with [`method: Locator
|
||||
You can specify option `value`, or `label` to select. Multiple options can be selected.
|
||||
|
||||
```js
|
||||
// Single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
await page.getByLabel('Choose a color').selectOption('blue');
|
||||
|
||||
// Single selection matching the label
|
||||
@ -155,7 +155,7 @@ await page.getByLabel('Choose multiple colors').selectOption(['red', 'green', 'b
|
||||
```
|
||||
|
||||
```java
|
||||
// Single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
page.getByLabel("Choose a color").selectOption("blue");
|
||||
|
||||
// Single selection matching the label
|
||||
@ -166,7 +166,7 @@ page.getByLabel("Choose multiple colors").selectOption(new String[] {"red", "gre
|
||||
```
|
||||
|
||||
```python async
|
||||
# Single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
await page.get_by_label('Choose a color').select_option('blue')
|
||||
|
||||
# Single selection matching the label
|
||||
@ -177,7 +177,7 @@ await page.get_by_label('Choose multiple colors').select_option(['red', 'green',
|
||||
```
|
||||
|
||||
```python sync
|
||||
# Single selection matching the value
|
||||
# Single selection matching the value or label
|
||||
page.get_by_label('Choose a color').select_option('blue')
|
||||
|
||||
# Single selection matching the label
|
||||
@ -188,7 +188,7 @@ page.get_by_label('Choose multiple colors').select_option(['red', 'green', 'blue
|
||||
```
|
||||
|
||||
```csharp
|
||||
// Single selection matching the value
|
||||
// Single selection matching the value or label
|
||||
await page.GetByLabel("Choose a color").SelectOptionAsync("blue");
|
||||
|
||||
// Single selection matching the label
|
||||
|
||||
6
packages/playwright-core/types/types.d.ts
vendored
6
packages/playwright-core/types/types.d.ts
vendored
@ -3676,7 +3676,7 @@ export interface Page {
|
||||
* **Usage**
|
||||
*
|
||||
* ```js
|
||||
* // single selection matching the value
|
||||
* // Single selection matching the value or label
|
||||
* page.selectOption('select#colors', 'blue');
|
||||
*
|
||||
* // single selection matching the label
|
||||
@ -6772,7 +6772,7 @@ export interface Frame {
|
||||
* **Usage**
|
||||
*
|
||||
* ```js
|
||||
* // single selection matching the value
|
||||
* // Single selection matching the value or label
|
||||
* frame.selectOption('select#colors', 'blue');
|
||||
*
|
||||
* // single selection matching both the value and the label
|
||||
@ -9988,7 +9988,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
* **Usage**
|
||||
*
|
||||
* ```js
|
||||
* // single selection matching the value
|
||||
* // Single selection matching the value or label
|
||||
* handle.selectOption('blue');
|
||||
*
|
||||
* // single selection matching the label
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user