import win32com.client, pythoncom
from time import sleep
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1
ie.Navigate('http://www.cpplab.com/Articles/JSCalls/TestPage/JSCallTestPage.htm')
sleep(5) # Give it time to get there.
id=ie.Document.Script._oleobj_.GetIDsOfNames('Multiply') # 'Multiply' is the function name.
#5 and 2 below are the parameters passed to the function 'Multiply'.
res=ie.Document.Script._oleobj_.Invoke(id, 0, pythoncom.DISPATCH_METHOD, True, 5, 2)
python 使用COM执行JS
最新推荐文章于 2024-01-15 20:17:18 发布