# Firefox (Legacy)

Se puede probar un entorno de navegador basado en Firefox cuando el entorno de Chrome no proporciona resultados aceptables. El entorno de Firefox evita la detección de bots 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**. No se admiten otras versiones. 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 de WebSocket:

```
wss://ubs.Oxylabs.io
```

## Consideraciones importantes

* Requiere el uso explícito de la implementación `firefox` en las bibliotecas de automatización
* Puede requerir ajustes menores 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. a través del 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 con sede en EE. UU., y no debe confundirse con la selección de geolocalización de proxy. Más información sobre eso en la siguiente sección.&#x20;
{% endhint %}

## Selección de país

Puedes especificar un país para tu sesión de navegador agregando el `?p_cc` parámetro a la URL de su 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 ningún país, el sistema asignará automáticamente uno según la disponibilidad.


---

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