> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/pt-br/headless-browser/firefox.md).

# Firefox (Legado)

Um ambiente de navegador baseado no Firefox pode ser testado quando o ambiente do Chrome não consegue fornecer resultados aceitáveis. O ambiente do Firefox lida com o gerenciamento de acesso confiável por meio de modificações internas e integração automática de proxy.

{% hint style="info" %}
O endpoint do Firefox oferece suporte a **duas versões do Playwright**: **1.51** e **1.56**. Outras versões não são suportadas. Você pode especificar a versão do Playwright por meio do `o_pw` parâmetro, por exemplo:

`wss://USER:PASS@ubs.oxylabs.io?o_pw=1.56`&#x20;
{% endhint %}

## Detalhes da conexão

Conecte-se à UBS usando o seguinte endpoint WebSocket:

```
wss://ubs.oxylabs.io
```

## Considerações importantes

* Exige o uso explícito da `firefox` implementação nas bibliotecas de automação
* Pode exigir pequenos ajustes em comparação com soluções baseadas no Chrome

## Uso básico

{% tabs %}
{% tab title="Python" %}

```python
from playwright.sync_api import sync_playwright

username = "your-username"
password = "your-password"
endpoint = "ubs.oxylabs.io"
browser_url = f"wss://{username}:{password}@{endpoint}"

with sync_playwright() as p:
    browser = p.firefox.connect(browser_url, timeout=60000)
    page = browser.new_page()
    page.goto('https://example.com')
    browser.close()
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const { firefox } = require('playwright');

(async () => {
    const username = 'your-username';
    const password = 'your-password';
    const endpoint = 'ubs.oxylabs.io';
    const browserUrl = `wss://${username}:${password}@${endpoint}`;

    const browser = await firefox.connect(browserUrl, { timeout: 60000 });
    const page = await browser.newPage();
    await page.goto('https://example.com');
    await browser.close();
})();
```

{% endtab %}
{% endtabs %}

## Infraestrutura de proxy nos Estados Unidos

Usuários que operam principalmente nos EUA podem se conectar diretamente à infraestrutura baseada nos EUA por meio do ponto de entrada especial. Isso garante tempo de carregamento mais rápido e melhor eficiência de navegação. Para estabelecer a conexão, selecione o seguinte:

```
wss://ubs-us.oxylabs.io
```

Exemplos de código:

{% tabs %}
{% tab title="Python" %}

```python
from playwright.sync_api import sync_playwright

username = "your-username"
password = "your-password"
endpoint = "ubs-us.oxylabs.io"
browser_url = f"wss://{username}:{password}@{endpoint}"

with sync_playwright() as p:
    browser = p.firefox.connect(browser_url, timeout=60000)
    page = browser.new_page()
    page.goto('https://example.com')
    browser.close()
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const { firefox } = require('playwright');

(async () => {
    const username = 'your-username';
    const password = 'your-password';
    const endpoint = 'ubs-us.oxylabs.io';
    const browserUrl = `wss://${username}:${password}@${endpoint}`;

    const browser = await firefox.connect(browserUrl, { timeout: 60000 });
    const page = await browser.newPage();
    await page.goto('https://example.com');
    await browser.close();
})();
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Observação:** esta solução principalmente reduz o tempo de resposta para usuários baseados nos EUA e não deve ser confundida com seleção de geolocalização do proxy. Mais sobre isso na seção seguinte.&#x20;
{% endhint %}

## Seleção de país

Você pode especificar um país para sua sessão de navegador adicionando o `?p_cc` parâmetro à sua URL de conexão. Aqui estão exemplos:

{% tabs %}
{% tab title="Python" %}

```python
from playwright.sync_api import sync_playwright

username = "your-username"
password = "your-password"
endpoint = "ubs.oxylabs.io"
country = "US"  # Replace with desired country code
browser_url = f"wss://{username}:{password}@{endpoint}?p_cc={country}"

with sync_playwright() as p:
    browser = p.firefox.connect(browser_url, timeout=60000)
    page = browser.new_page()
    page.goto('https://example.com')
    browser.close()
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const { firefox } = require('playwright');

(async () => {
    const username = 'your-username';
    const password = 'your-password';
    const endpoint = 'ubs.oxylabs.io';
    const country = 'US';  // Replace with desired country code
    const browserUrl = `wss://${username}:${password}@${endpoint}?p_cc=${country}`;

    const browser = await firefox.connect(browserUrl, { timeout: 60000 });
    const page = await browser.newPage();
    await page.goto('https://example.com');
    await browser.close();
})();
```

{% endtab %}
{% endtabs %}

Se nenhum país for especificado, o sistema atribuirá um automaticamente com base na disponibilidade.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://developers.oxylabs.io/products/pt-br/headless-browser/firefox.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.
