How to Auto Login to a web-site?

2019-09-14 07:16发布

Hello,

I need to login to a web-site automatically. It is a dashboard. Is there a URL link code which I can create as shortcut link or VBScript code to achieve this? Also is there a AppleScript for MAC?

1条回答
贪生不怕死
2楼-- · 2019-09-14 07:53

Here's an example of a javascript bookmarklet that creates a form hidden in a div at the bottom of the current page and then submits it. (I included a time stamp cause many dashboard logins include a hidden timestamp field in the form.)

javascript:self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);document.body.appendChild(document.createElement('div')).innerHTML='<form%20name="BletForm"%20method="POST"%20action="https://secure.mysite.com/index.asp?action=login"><input%20type="hidden"%20name=“domain”%20value=“mydomain”%20/><input%20type="hidden"%20name="username"%20value=“myname”%20/><input%20type="hidden"%20name="password"%20value=“mypassword"%20/><input%20type="hidden"%20name="hidDateTime"%20id="idhidDateTime"%20value=""%20/></form>';document.getElementById('idhidDateTime').value=+new%20Date()%20/1000%20|0;document.forms%5B'BletForm'%5D.submit();

You can use that code along with do javascript in safari for an Applescript solution. Something like:

set jsCode to "document.body.app..."
tell application "Safari"
    do JavaScript jsCode in current tab of window 1
end tell
查看更多
登录 后发表回答