I want to automate clicking the button “Leave the HTML5 Trial” or “Join the HTML5 Trial” on this webpage when I open it using a specific web browser
http://www.youtube.com/html5
my initial idea is to embed the webpage into a new HTML page and use javascript to click the button when the page is loaded, but it seems it can’t be embeded
any other ideas? thanKS!
It would be very bad if JavaScript allowed you to do this. Consider the security implications. For example, if a malicious site embedded a Facebook iframe and then simulated you clicking somewhere in that iframe, it could force you to unwillingly take an action you had no awareness of.
You cannot do this.
Update:
You say you need to script some operations. If you’re leaving/joining the HTML 5 trial for a specific user for which you know the YouTube login credentials, what you could try is scripting this server-side. This may be a little tricky, but you could use a tool like Fiddler or Wireshark to capture what the HTTP requests look like when you manually log in and click the button, then mimic these same actions in your script (using curl or wget or whatever is available in your environment).