I’ve hardcoded my username and password in the file (you’ll see I’ve excluded them here though). As you can see I’m trying to use the login box on the actual webpage at the moment since I’m unsure if the web service login is really helpful in this case. Need to store the login/session ID somewhere (it’s included in the url when the browser gets redirected after successful login). It’s used for subsequent calls such as starting the movie.
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://.*.voddler.com"<br />
plugin="http://player.voddler.com/VoddlerPlayer.swf"<br />
initialState="wait-for-frame-load"<br />
manualLock="true"<br />
version="1.0"><br />
<br />
<!-- Crop the control to better fill the application --><br />
<crop x="0" y="26" width="654" height="334" /><br />
<br />
<!-- The condition we use several times from within states to check if we're logged in or not --><br />
<condition name="need-to-login"><br />
<and><br />
<!-- Check if a specific element exists in the page, for example the loginform --><br />
<!-- Returns true if we need to login --><br />
<!-- <javascript script="document.cookie.indexOf('; skySSO=')" matches="-1" /> --><br />
<javascript script="document.getElementById('login_link').id" matches="login_link" /><br />
</and><br />
</condition><br />
<br />
<!-- Wait for frame to load --><br />
<state name="wait-for-frame-load"><br />
<event><br />
<condition><br />
<!-- Wait for the DOM to load... --><br />
<frameLoaded /><br />
</condition><br />
<action><br />
<!-- ...then goto the 'check-for-auth' state --><br />
<goto state="check-for-auth" /><br />
</action><br />
</event><br />
</state><br />
<br />
<!-- Check for auth --><br />
<state name="check-for-auth"><br />
<event><br />
<condition><br />
<!-- If we don't need to login, goto state 'playing' --><br />
<not><br />
<condition name="need-to-login" /><br />
</not><br />
</condition><br />
<action><br />
<goto state="playing" /><br />
</action><br />
</event><br />
<event><br />
<!-- If we *do* need to login, visit the login url and attempt to submit it --><br />
<condition><br />
<condition name="need-to-login" /><br />
</condition><br />
<action><br />
<!-- The state machine will wait until the URL has fully loaded before moving --><br />
<!-- onto the next state. --><br />
<visit url="http://www.voddler.com/en/login"/><br />
<goto state="try-to-login"/><br />
</action><br />
</event><br />
</state><br />
<br />
<!-- Try to login --><br />
<state name="try-to-login"><br />
<event><br />
<condition><br />
<!-- No condition required --><br />
<javascript script="true ? 1 : 0" matches="1" /><br />
</condition><br />
<action><br />
<!-- Fill in the username, password and nexturl of the page. --><br />
<!-- We need to submit the form so that the page's handlers can populate the other --><br />
<!-- required post data. --><br />
<!--<br />
<run script="page='${url}';index=page.indexOf('/page/');document.login.userName.value='${username}';document.login.password.value='${password}';document.login.nextUrl.value=page.substring(index);document.login.submit();" /><br />
--><br />
<run script="document.getElementsByName('email')[0].value='<hardcoded email>';document.getElementsByName('password')[0].value='<hardcoded password>';document.getElementsByClass('button_submit')[0].click()" /><br />
<pause time="2000" /><br />
<goto state="check-for-auth-again" /><br />
</action><br />
</event><br />
</state><br />
<br />
<!-- Check for auth again --><br />
<state name="check-for-auth-again"><br />
<event><br />
<condition><br />
<!-- If login was successful we should now not need to login and can go to the state 'cleanup' --><br />
<not><br />
<condition name="need-to-login" /><br />
</not><br />
</condition><br />
<action><br />
<visit url="${url}" /><br />
<goto state="playing" /><br />
</action><br />
</event><br />
<event><br />
<condition><br />
<!-- If we still need to login after we've tried to login, something is wrong... --><br />
<condition name="need-to-login" /><br />
</condition><br />
<action><br />
<goto state="end" param="Please check your username and password in the plugin's settings" /><br />
</action><br />
</event><br />
</state><br />
<br />
<!-- Playing --><br />
<state name="playing"><br />
<event><br />
<condition><br />
<javascript script="true ? 1 : 0" matches="1" /><br />
</condition><br />
<action><br />
<!-- Done! We don't need to do anything else here --><br />
</action><br />
</event><br />
</state><br />
<br />
</site>
Is there any way to log values from the DOM fetched via javascript to the log file?
[s]Looks like it (my javascript) might be failing at the login step[/s]
removed old log for easier reading
**UPDATE**: Got past the login screen! document.getElementsBy**ClassName**('button_submit')[0].click(); is the method to use...
The log continues:
May 11, 2011 23:47:04 [0xa0a51540] DEBUG - Executing Moving to state check-for-auth-again<br />
<br />
Check if logged in:<br />
May 11, 2011 23:47:04 [0xa0a51540] DEBUG - Executed 'document.getElementById('login_link').id' and now seeing if [undefined] matches [login_link]<br />
<br />
Login_link is missing so we proceed to the actual url:<br />
May 11, 2011 23:47:04 [0xa0a51540] DEBUG - Executing Visiting ${url}<br />
May 11, 2011 23:47:04 [0xa0a51540] DEBUG - Browsing to URL: http://www.voddler.com/en/movie/info/2788190073758226675/the-cider-house-rules/<br />
May 11, 2011 23:47:04 [0xa0a51540] DEBUG - Stopping execution, waiting for 1<br />
<br />
What's this?<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - 0x1aa4aac0 Plugin loaded [(null)] (0 1830 300 150 )<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - 0x17008d30 Plugin loaded [eas.statcamp.net/media.4/149/12560/126847/250x360_cdf5c772.swf?clickTAG=http://eas.statcamp.net/eas/cu=0::camp=126847::no=176815::kw=link1-176815::encoding=utf-8::EASLink=http://clk.tradedoubler.com/click?p=206289%26loc=95214%26g=19678948%26url=http://a7f62bea-50a0-4b04-bd6f-3e2aacfddde9.statcamp.net/turl/?id=ac1cec7beea5414b9ae0fcb22aca9b5c%26cid=f983badbbf064fa8b31566519cd6ac44%26lpid=62b6aa113d0f451caa1988c7973ea106] (0 0 250 360 eas_13051504264806)<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Frame was loaded.<br />
<br />
Checking if we're still logged in:<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Executed 'document.getElementById('login_link').id' and now seeing if [undefined] matches [login_link]<br />
<br />
We are, but should it really load the page again?<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Executing Visiting ${url}<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Browsing to URL: http://www.voddler.com/en/movie/info/2788190073758226675/the-cider-house-rules/<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Stopping execution, waiting for 1<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Frame was loaded.<br />
<br />
Launching play state:<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Executing Moving to state playing<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Received title [The Cider House Rules - Voddler.com Movies].<br />
May 11, 2011 23:47:06 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:07 [0xa0a51540] DEBUG - Received title [ ].<br />
May 11, 2011 23:47:07 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:08 [0xa0a51540] DEBUG - Received title [Like | Facebook].<br />
May 11, 2011 23:47:08 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:08 [0xa0a51540] DEBUG - 0x170a8be0 Plugin loaded [(null)] (0 1723 300 150 )<br />
May 11, 2011 23:47:08 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:08 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
<br />
This looks like commercials which makes sense, but maybe it's just a banner on the page.<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - 0x28f9760 Plugin loaded [track.adform.net/Banners/Elements/Files/2101/15622.swf?ADFassetID=15622&bv=7] (-9999 -9999 250 360 adfdiv_850961921411_swf)<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Received title [XD Proxy].<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Frame was loaded.<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]<br />
May 11, 2011 23:47:09 [0xa0a51540] DEBUG - Executed 'true ? 1 : 0' and now seeing if [1] matches [1]
Any ideas?