Last active
October 27, 2016 15:06
-
-
Save kyab/9bdec6b40713e1b1c2f6bac2e6ce0262 to your computer and use it in GitHub Desktop.
Coursera Wiki for Machine Learning require login every time and page itself is so slow. This Script automatically go to main WikiPage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = Application("Safari"); | |
doc = app.Document().make(); | |
win = app.windows[doc.name()]; | |
win.currentTab.url = "https://share.coursera.org/wiki/index.php/ML:Main"; | |
tab = app.windows[0].currentTab(); //somehow we need this. | |
ret = false; | |
do { | |
ret = app.doJavaScript( "document.getElementById('bodyContent') == null", {in:tab}); | |
delay(0.2); | |
}while(ret==true); | |
console.log("ロード完了"); | |
app.doJavaScript("document.getElementById('bodyContent').getElementsByTagName('a')[2].click();", {in:tab}); | |
ret = false; | |
do { | |
ret = app.doJavaScript( "document.getElementById('mw-returnto') == null", {in:tab}); | |
delay(0.2); | |
}while(ret==true); | |
console.log("ロード完了2"); | |
app.doJavaScript("document.getElementById('mw-returnto').childNodes[1].click();",{in:tab}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment