开发者

Using appscript how can I accept self-signed SSL cert in Safari

I'm trying to automate some stuff which involves browsing to a https url. I'm using py-appscript with Safari on Mac OS X. But when Safari navigates to the https URL, since I have a self-signed certificate, it throws up a popup window which asks you to accept it to continue. I could not figure out a way to do this. Sure using signed certificates will solve the problem but I was curious if it is even po开发者_如何学编程ssible via appscript to accept or click on the popup dialog boxes on Safari?


Well, answering my own question. Hopefully it'll be useful to someone...

from appscript import *

app(u'Safari').activate()
title = app(u'Safari').do_JavaScript(u'document.title', in_=app.documents[1])
app(u'Safari').documents[1].URL.set(u'https://localhost/')
app(u'System Events').application_processes[u'Safari'].windows[title].sheets[1].groups[2].UI_elements[u'Continue'].click()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜