Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

376
Views
Testcafe: haga clic en la casilla de verificación dentro de un elemento virtual (#documento)

Así que aquí está la sección HTML que describe mi elemento reCAPTCHA y la parte de color azul es a la que intento acceder: Sección HTML del elemento reCAPTCHA

Soy consciente de que existen otras soluciones alternativas para los elementos reCAPTCHA. Pero tengo curiosidad por saber si es posible simplemente hacer clic en la casilla de verificación porque la prueba de todos modos no aparece y pasa automáticamente cuando hago clic en la casilla de verificación manualmente.

Hasta ahora he probado este código:

 import { Selector } from 'testcafe'; fixture`Starting test 02.` .page`https://etherscan.io/register`; test('Test 02', async t => { const checkbox = Selector('.g-recaptcha').find('div').find('div').find('iframe'); await t .click(checkbox, { offsetX: 20 , offsetY: 25 }) });

Pero no sé cómo ingresar al elemento #document. Lo que me pregunto es que mi elemento final es del tipo "intervalo" y no "entrada", pero contiene una lista de eventos donde se incluye "clic". ¿Es posible acceder a este elemento span con testcafe y desencadenar un evento de clic? ¿Tienes alguna otra sugerencia de lo que podría probar?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Debe usar t.switchToIframe(selector) para cambiar a iFrame. Puede obtener más información en la documentación: https://testcafe.io/documentation/402681/reference/test-api/testcontroller/switchtoiframe

about 4 years ago · Juan Pablo Isaza Report

0

Así que la solución para esto es la siguiente:

 import { Selector } from 'testcafe'; fixture`Starting test.` .page`https://etherscan.io/register`; test('Test', async t => { // Switch to the recaptcha iframe element and click on the checkbox await t .switchToIframe(Selector('iframe').withAttribute('title','reCAPTCHA')) .click('#recaptcha-anchor.recaptcha-checkbox.goog-inline-block.recaptcha-checkbox-unchecked.rc-anchor-checkbox'); });

Pero tengo que tener en cuenta que cuando usa testcafe, el reCAPTCHA de Google siempre le dará alguna prueba y nunca simplemente marcará la casilla sin ninguna prueba, ya que puede suceder cuando lo hace a mano.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!