我意識到有幾個關於此的線程,他們都是非常具體的某些網站。我的背景是Python,而不是Javascript或Applescript,我對如何實現這個動作感到困惑。使用Javascript | Applescript單擊Safari中的按鈕
我見過幾個腳本做這個動作,即:
tell application "Safari"
activate
do JavaScript "document.forms['search']['order_list_search_batch'].click()"
end tell
什麼是擔當了這一點,最好的方法是什麼?
我是在"document.forms[WHATGOESHERE?].click()"
之間
我試圖點擊http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi繼續按鈕發生的事情感到困惑。
我又繼續按鈕「檢查元素」,並得到這個代碼:
<input style="cursor: pointer;" value="" name="proceed" class="proceed" onmouseover="this.style.cursor="pointer"" type="submit">
我怎麼知道要放什麼東西在腳本中單擊基於檢查元素結果掉這個按鈕?我想明白,所以我可以在多個案例中使用這種方法。這裏沒有href鏈接。
當前的代碼不工作
tell application "Safari" to activate
open location "http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi"
delay 3
tell application "Safari" to do JavaScript "document.forms[0].elements[document.forms[0].elements.length-1]"