むしろよりダウンロードウィンドウを処理することができ見つけることができます
import org.sikuli.script.*;
public class TestSikuli {
public static void main(String[] args) {
Screen s = new Screen();
try{
s.click("imgs/spotlight.png", 0);
s.wait("imgs/spotlight-input.png");
s.type(null, "hello world\n", 0);
}
catch(FindFailed e){
e.printStackTrace();
}
}
}
デフォルトアプリケーション:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("pdfjs.disabled", true); // disable the built-in viewer
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.panel.shown", false);
profile.setPreference("browser.helperApps.neverAsk.openFile", "application/vnd.ms-excel");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "");
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://www.exinfm.com/free_spreadsheets.html");
driver.findElement(By.linkText("Capital Budgeting Analysis")).click();
注意してくださいあなたのファイルの1つでMIMEタイプ(application/vnd.ms-excel
)を更新する必要があります。 MIMEタイプは、応答ヘッダーのContent-Type
です。
そして、あなただけのダイアログを閉じたい場合は、その後、私はのAutoItを使用します。
WinWait("[CLASS:MozillaDialogClass]", "", 10)
WinClose("[CLASS:MozillaDialogClass]")
私は基本的には[OK]ボタンをクリックし、Excelドキュメントを開きますので、それを却下します。それは難しいようです。 LOL .... –