> 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/es/headless-browser/firefox.md).

# Firefox (heredado)

Se puede probar un entorno de navegador basado en Firefox cuando el entorno de Chrome no logra proporcionar resultados aceptables. El entorno de Firefox gestiona el acceso fiable mediante modificaciones integradas e integración automática de proxy.

{% hint style="info" %}
El endpoint de Firefox admite **dos versiones de Playwright**: **1.51** y **1.56**. Otras versiones no son compatibles. Puede especificar la versión de Playwright mediante el `o_pw` parámetro, por ejemplo:

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

## Detalles de conexión

Conéctese a UBS usando el siguiente endpoint WebSocket:

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

## Consideraciones importantes

* Requiere el uso explícito de `firefox` la implementación en las bibliotecas de automatización
* Puede requerir pequeños ajustes en comparación con las soluciones basadas en 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 %}

## Infraestructura de proxy de Estados Unidos

Los usuarios que operan principalmente en EE. UU. pueden conectarse directamente a la infraestructura con sede en EE. UU. mediante el punto de entrada especial. Esto garantiza un tiempo de carga más rápido y una mejor eficiencia de navegación. Para establecer la conexión, seleccione lo siguiente:

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

Ejemplos 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" %}
**Nota:** esta solución principalmente reduce el tiempo de respuesta para los usuarios basados en EE. UU. y no debe confundirse con la selección de la geolocalización del proxy. Más sobre eso en la siguiente sección.&#x20;
{% endhint %}

## Selección de país

Puede especificar un país para su sesión de navegador añadiendo el `?p_cc` parámetro a su URL de conexión. Aquí tiene ejemplos:

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

```python
from playwright.sync_api import sync_playwright

username = "your-username"
password = "your-password"
endpoint = "ubs.oxylabs.io"
country = "US"  # Reemplace con el código de país deseado
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';  // Reemplace con el código de país deseado
    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 %}

Si no se especifica un país, el sistema asignará uno automáticamente según la disponibilidad.


---

# 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/es/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.
