<commit_before>Represents the select control. By default is being searched by the label. It is possible to select an option by the text or value. Default selection is performed by text.

```html
<select id="brand">
  <option value="">--select--</option>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select> 
```

There are different approaches to configure `Select` control.

### Select Using Enum

The above select can be described with the following enum:

```cs
public enum CarBrand
{
    [Term("--select--")]
    None,
    Volvo,
    Saab,
    Mercedes,
    Audi
}
```

#### Select By Text

```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        public Select<CarBrand, _> Brand { get; private set; }
    }
}
```
```cs
Go.To<SamplePage>().
    Brand.Should.Equal(CarBrand.None).
    Brand.Set(CarBrand.Audi).
    Brand.Should.Equal(CarBrand.Audi);
```

#### Select By Value

You just need to mark the select property with `[SelectByValue]` attribute and optionally set settings like `Case` or `Format`.

```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        [SelectByValue(TermCase.Lower)]
        public Select<CarBrand, _> Brand { get; private set; }
    }
}
```

`TermCase.Lower` is defined in `SelectByValue` attribute because option values are lowercase in this example (e.g. volvo).

### Select Using String

Don't pass data generic type argument to use string variant of control, simply use `Select<_>` (or alternatively `Select<string, _>`).

```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        public Select<_> Brand { get; private set; }
    }
}
```
```cs
Go.To<SamplePage>().
    Brand.Set("Audi").
    Brand.Should.Equal("Audi");
```

### Select Using Int

It is also possible to select an option by `int` and other types. The following sample shows how to select using `int` type together with the formatting.

```html
<select id="priority">
  <option value="1">Priority 1</option>
  <option value="2">Priority 2</option>
  <option value="3">Priority 3</option>
  <option value="4">Priority 4</option>
  <option value="5">Priority 5</option>
</select> 
```
```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        [Format("Priority {0}")]
        public Select<int, _> Priority { get; private set; }
    }
}
```
```cs
Go.To<SamplePage>().
    Priority.Set(3).
    Priority.Should.Equal(3);
```

Supports `[SelectByText]`, `[SelectByValue]`, `[Format]` and `[Culture]` settings attributes.
{:class="info"}<commit_msg>Update "Components/Select" section<commit_after>Represents the select control. By default is being searched by the label. It is possible to select an option by the text or value. Default selection is performed by text.

Supports `[SelectByText]`, `[SelectByValue]`, `[Format]` and `[Culture]` settings attributes.
{:class="info"}

```html
<select id="brand">
  <option value="">--select--</option>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select> 
```

There are different approaches to configure `Select` control.

### Select Using Enum

The above select can be described with the following enum:

```cs
public enum CarBrand
{
    [Term("--select--")]
    None,
    Volvo,
    Saab,
    Mercedes,
    Audi
}
```

#### Select By Text

```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        public Select<CarBrand, _> Brand { get; private set; }
    }
}
```
```cs
Go.To<SamplePage>().
    Brand.Should.Equal(CarBrand.None).
    Brand.Set(CarBrand.Audi).
    Brand.Should.Equal(CarBrand.Audi);
```

#### Select By Value

You just need to mark the select property with `[SelectByValue]` attribute and optionally set settings like `Case` or `Format`.

```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        [SelectByValue(TermCase.Lower)]
        public Select<CarBrand, _> Brand { get; private set; }
    }
}
```

`TermCase.Lower` is defined in `SelectByValue` attribute because option values are lowercase in this example (e.g. volvo).

### Select Using String

Don't pass data generic type argument to use string variant of control, simply use `Select<_>` (or alternatively `Select<string, _>`).

```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        public Select<_> Brand { get; private set; }
    }
}
```
```cs
Go.To<SamplePage>().
    Brand.Set("Audi").
    Brand.Should.Equal("Audi");
```

### Select Using Int

It is also possible to select an option by `int` and other types. The following sample shows how to select using `int` type together with the formatting.

```html
<select id="priority">
  <option value="1">Priority 1</option>
  <option value="2">Priority 2</option>
  <option value="3">Priority 3</option>
  <option value="4">Priority 4</option>
  <option value="5">Priority 5</option>
</select> 
```
```cs
using Atata;
using _ = SampleApp.SamplePage;

namespace SampleApp
{
    public class SamplePage : Page<_>
    {
        [FindById]
        [Format("Priority {0}")]
        public Select<int, _> Priority { get; private set; }
    }
}
```
```cs
Go.To<SamplePage>().
    Priority.Set(3).
    Priority.Should.Equal(3);
```
{'fraction_non_alphanumeric': 0.14329738058551617, 'fraction_numerical': 0.004451292586885807, 'mean_word_length': 3.6512738853503186, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6095662', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1810, 'n_words': 567}