简体   繁体   中英

How to get Python to run JavaScript on a open chrome tab?

I've made a python script that grabs IPs you connect to on a website and stores them. I'm checking each time since I don't want to connect to the same IP twice. (This is a bit buggy since I get multiple requests, if someone can explain how to put a timer on the skip call without disrupting the rest of the program).

To auto skip them I'm trying to write a JS script to do so. I think I have the click figured out, but how do I get my python script (local) to tell the javascript to run in the browser? Chrome specifically if that helps.

您可以为所需的浏览器使用 webdriver 并在浏览器头中执行 javascript 代码,然后从 python 代码在浏览器头中执行 javascript,就像此应用程序中的自动登录注释功能https://github.com/engMaher/BAF/ blob/master/BAF_0.2.0.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM