# Что такое драйвер браузера?

### **1️⃣ Что такое драйвер браузера**

* Драйвер браузера — это **программа-посредник** между твоим кодом автоматизации (например, Selenium) и реальным браузером.
* Он **принимает команды** из теста и **управляет браузером**: открывает страницы, кликает по кнопкам, вводит текст и т.д.

#### 🔹 Роль в тестах

1. Тесты пишутся на языке программирования (Python, Java, C#).
2. Код теста посылает команды через **Selenium WebDriver API**.
3. **Драйвер** переводит команды в действия в браузере.

***

### **2️⃣ Примеры драйверов браузеров**

| Браузер | Драйвер                     |
| ------- | --------------------------- |
| Chrome  | **chromedriver**            |
| Firefox | **geckodriver**             |
| Edge    | **msedgedriver**            |
| Safari  | встроенный **safaridriver** |

***

### **3️⃣ Пример использования в Python + Selenium**

```python
from selenium import webdriver

# Инициализация драйвера для Chrome
driver = webdriver.Chrome(executable_path="/path/to/chromedriver")

# Открыть страницу
driver.get("https://example.com")

# Найти элемент и кликнуть
driver.find_element("id", "login-btn").click()

# Закрыть браузер
driver.quit()
```

* `webdriver.Chrome()` → создаёт соединение с браузером через **chromedriver**
* Все действия (click, send\_keys, get) проходят **через драйвер**

***

#### 🔹 Ключевая мысль

* **Драйвер браузера = мост между тестами и браузером.**
* Без драйвера Selenium не сможет управлять браузером.


---

# 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://kaze.gitbook.io/qa-theory/teoriya-avtomatizirovannogo-testirovaniya/obshie-voprosy/chto-takoe-draiver-brauzera.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.
