简体   繁体   中英

Running a script command remotely using Python

I have a Python program that uses BeautifulSoup to extract some data from a website.

In Google Chrome, there is this option called the Developers Console; it is used to execute javascript commands live right on the webpage.

Is there a way, or a work-around-of-a-way to execute javascript commands remotely using Python? Like casting a webpage to an object and running a javascript command in the background (without launching a new Chrome window)?

You can use Native Messaging API to communicate between a shell script and the browser.

You can also launch Chrome or Chromium with --headless flag set. See also puppeteer .

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