开发者

Determine current Mac Chrome web page using Python

Is there a way to determine programmaticall开发者_开发技巧y, using Python, which web page is currently active in Google Chrome?


Google Chrome for Mac has added the AppleScripting method for getting the URL.

Here's the Chromium AppleScript SDK

https://sites.google.com/a/chromium.org/dev/developers/design-documents/applescript

Example from the page linked below:

tell application "Google Chrome"
   get URL of active tab of window 1
end tell

More examples here:

http://laclefyoshi.blogspot.com/2010/10/google-chrome-ver.html


Not yet, it seems. Such tasks are done, with other browsers, via the Applescript interface, but, as this thread shows, while hotly requested for Chrome on the Mac this feature is not there yet.

(Once a Mac app does get a good Applescript interface, there are several ways to use that interface from Python, without needing to actually involve Applescript as a language -- this has been touched upon on other SO questions about other apps -- but the problem is that Chrome in particular doesn't yet support this quintessentially Mac-ish functionality).

Given the insistence of the request I'd expect somebody to eventually roll up their sleeves and contribute a patch for the purpose, but it doesn't seem to have occurred yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜