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

165
Views
¿Ejecutar un bucle "for" en JavaScript a través de Python-Selenium?

Uso Javascript para recopilar datos de una página HTML a través de Selenium; sin embargo, no puedo ejecutar la parte de Javascript desde mi computadora a través de Selenium/py porque Python solo ofrece driver.execute_script('string of a script') , mientras que tengo un bucle for de varias líneas que no se ejecutará con estos comandos.

El lazo:

 for (let i = 0; i < Values.length; i++) { if (Values[i].getAttribute('automation-id') === 'contact-wealth-manager') { ele = Values[i] } }

Como puede probar, esto no funcionará con el estándar "driver.execute_script("let value = '';")

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

0

Para ejecutar el Javascript de bucle multilínea, debe pasar el script como argumento al método execute_script() de la siguiente manera:

 driver.execute_script(""" for (let i = 0; i < Values.length; i++) { if (Values[i].getAttribute('automation-id') === 'contact-wealth-manager') { ele = Values[i] } } """)
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!