有關(guān)sikuli的介紹,和簡(jiǎn)單使用請(qǐng)參考:http://www.cnblogs.com/tobecrazy/p/4516369.html
	  關(guān)于sikuli的缺點(diǎn):
	  1.運(yùn)行腳本時(shí)候,必須截圖,圖片比較占用系統(tǒng)空間
	  2.腳本執(zhí)行過(guò)程中,不能移動(dòng)鼠標(biāo),而selenium可以小化,任意移動(dòng)鼠標(biāo)
	  話不多說(shuō),介紹一下場(chǎng)景:
	  1.打開百度
	  2.右鍵單擊百度logo
	  3.點(diǎn)擊彈出菜單的save as
	  4. 輸入保存位置和文件名
	  5. 點(diǎn)擊保存菜單
	  首先要做的是,截圖,截圖保存位置c:/selenium
	  腳本如下:
	//create chrome webDriver with parameter
	ChromeOptions options = new ChromeOptions();
	options.addArguments("--test-type");
	Screen screen=new Screen();
	System.setProperty("webdriver.chrome.driver", "C:\webdriver\chromedriver.exe");
	WebDriver driver = new ChromeDriver(options);
	String login_url="https://www.baidu.com/";
	driver.get(login_url);
	driver.manage().window().maximize();
	driver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
	driver.manage().timeouts().pageLoadTimeout(90, TimeUnit.SECONDS);
	//find baidu logo
	WebElement baiduLogo=driver.findElement(By.xpath("//div[@id='lg']/img"));
	Actions actions = new Actions(driver);
	//right click
	actions.contextClick(baiduLogo).perform();
	Pattern saveAs =new Pattern("c:\selenium\saveAs.png");
	screen.click(saveAs);
	Pattern inputBox1 =new Pattern("c:\selenium\inputBox1.png");
	screen.find(inputBox1);
	screen.type("c:\selenium\baiduLogo.png");
	Pattern saveButton =new Pattern("c:\selenium\saveButton.png");
	screen.click(saveButton);
	//wait for 60s to verify download success or not
	try
	{
	Thread.sleep(60000);
	} catch (Exception e)
	{
	// TODO Auto-generated catch block
	e.printStackTrace();
	}
	finally
	{
	File f=new File("c:\selenium\baiduLogo.png");
	if(f.exists())
	{
	System.out.println("PASS");
	}
	driver.close();
	}