Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
driver.switchTo.frame no es una función

Soy nuevo en Selenium. Aquí está la tarea:

  1. Abra https://pastebin.com
  2. Pegue "Hola desde WebDriver"
  3. Establezca el vencimiento pasado en 10 minutos // Tengo problemas aquí
  4. Establezca el título de pegado como "helloweb"

estoy usando javascript, con chromedriver

Puedo abrir el menú desplegable pero no puedo elegir el tiempo de vencimiento, dice:

 ElementClickInterceptedError: element click intercepted: Element <span class="select2-selection__arrow" role="presentation">...</span> is not clickable at point (422, 569). Other element would receive the click: <iframe frameborder="0" src="https://9c4fe1b6ba8be5733ce3e7442f84515f.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html" id="google_adsiframe/22653346938/12825_Pastebin.com/12825_Pastebin.com_SmartBanner_1_0" title="3rd party ad content" name="" scrolling="no" marginwidth="0" marginheight="0" width="970" height="90" data-is-safeframe="true" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" role="region" aria-label="Advertisement" tabindex="0" data-google-container-id="1" style="border: 0px; vertical-align: bottom;" data-load-complete="true"></iframe>

Entonces descubrí que las opciones están ocultas dentro de un marco (soy nuevo en esto). Usé la función driver.switchTo.frame(driver.findElement(xpath))

Aquí está mi código:

 const { Browser } = require('selenium-webdriver'); const {Builder, By, Key, until} = require('selenium-webdriver'); const { waitForServer } = require('selenium-webdriver/http/util'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); driver.manage().window().maximize(); try { await driver.get('https://pastebin.com'); await driver.findElement(By.xpath('//*[@id="postform-text"]')).sendKeys('Hello from WebDriver'); await driver.findElement(By.xpath('//*[@id="w0"]/div[5]/div[1]/div[2]/div/span/span[1]/span/span[2]')).click() await driver.switchTo.frame(driver.findElement(By.xpath('//*[@id="postform-expiration"]/option[3]'))).click() await driver.findElement(By.xpath('//*[@id="postform-name"]')).sendKeys('helloweb'); await driver.findElement(By.xpath('//*[@id="w0"]/div[5]/div[1]/div[8]/button')).click(); } finally { await driver.quit(); } })();

Pero dice "driver.switchTo.frame no es una función". ¿Cómo puedo arreglar esto? Por favor ayuda

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Elimine .click() del código de cambio a línea de cuadro.

 await driver.switchTo.frame(driver.findElement(By.xpath('//*[@id="postform-expiration"]/option[3]')));
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda