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

115
Views
¿Sería posible abrir un sitio web y luego ejecutar JavaScript usando Python?

He estado intentando abrir un sitio web (usando python), luego ejecutar un script de JavaScript en él.

Hice la parte de abrir el sitio web, pero no he logrado que JavaScript se ejecute después de que se carga la página.

 import os url='example.com' jscode='alert(\'success\')' os.system('start chrome.exe '+url+' javascript:'+jscode)

El código anterior es lo mejor que se me ocurre.

Abre el sitio web pero no ejecuta el javascript.

os.system() porque otros métodos tienen problemas con Chrome.

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

0

Me lo imaginé:

VBScript y lote juntos para abrir el sitio y luego ingrese las pulsaciones de teclas

' https://www.codegrepper.com/code-examples/whatever/Make+a+batch+file+that+opens+site+in+browser+and+enter+login+information ' fue muy útil para desarrollar esta respuesta

 ''' enclosed in '{}' means special characters '~' or '{ENTER}' = [ENTER] '^' = [CTRL] multiple characters in the same list item are typed at the same time ''' keyplan = ["^l","javascript:alert{(}'success'{)}","~"] with open('temp.cmd','w') as f: pass with open('temp.cmd', 'a') as f: #batch code section f.write( '@if (@CodeSection == @Batch) @then\n' +'@echo off\n' +'set SendKeys=CScript //nologo //E:JScript "%~F0"\n') +'START CHROME "example.com"\n' +'timeout /t 10\n' )#the timeout is to give time for the page to load #log keys in plan for key in keyplan: f.write('%SendKeys% "'+key+'"\n') f.write('goto :EOF\n') f.write('@end\n') #VBScript section f.write('var WshShell = WScript.CreateObject("WScript.Shell");\n') #send keys (runs on every '%SendKeys% "key") f.write('WshShell.SendKeys(WScript.Arguments(0));\n') os.system("temp.cmd")

Después de escribir esto, me di cuenta de que import pynput es un método que no involucraría a os.system .

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!