# Browser

## Configuration

Keys in settings file, e.g. `_wasd_settings.yml`:

* `url` *required:* Your app URL;
* `implicit_timeout`: Implicit wait timeout in seconds, default `5`;
* `window_size`: `'maximize'` or explicitly `'1280x1024'`, default `'800x600'`;
* `protocol`: remote WebDriver protocol, default `'http'`;
* `host`: remote WebDriver host, default `'localhost'`;
* `port`: remote WebDriver port, default `'4444'`;
* `path`: remote WebDriver path, default `'/wd/hub'`;
* `foo_bar_baz`: any data, e.g.:

```yaml
username: 'admin'
password: 'themostsecurepasswordintheworld'
```

* `capabilities` *required:* Selenium desired capabilities, e.g. for **Chrome**:

```yaml
capabilities:
    browserName: 'chrome'
    unexpectedAlertBehaviour: 'accept'
    loggingPrefs:
        browser: 'INFO'
    chromeOptions:
        args: ['--disable-infobars']
```

{% hint style="info" %}
Note:  The key`"chromeOptions"` was changed in chromedriver v2.31 to `"goog:chromeOptions"`
{% endhint %}

## Locating Elements

Most methods operate on a DOM element. Locator must be instance of`Element` class.

```markup
<!-- Given DOM -->
<foo id="parent">
    <bar id="child" class="message">Hello world!</bar>
    <bar id="child" class="message">Goodbye and Farewell!</bar>
</foo>
```

```python
from wasd.wd import Element as E

# To locate <foo> element:
foo = E("foo")
foo = E("#parent")

# To locate <bar> element:
bar = E("bar")
bar = E(".message")
bar = E("#child", E("//foo")) # Pass a second argument
                                # to locate element within given context
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aurococcus.gitbook.io/wasd/modules/browser.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
