autoitx ai = autoitx.INSTANCE;
WebDriver driver = new FirefoxDriver();
driver.get("http://www.autoitscript.com/autoit3/downloads.shtml");
FirefoxWebElement downloadpic = (FirefoxWebElement) driver.findElement(By.cssSelector("img[alt=\"Download AutoIt\"]"));
int X = (int) downloadpic.getLocationOnScreenOnceScrolledIntoView().getX();
int Y = (int) downloadpic.getLocationOnScreenOnceScrolledIntoView().getY();
int offsetX = (int) downloadpic.getSize().getWidth();
int offsetY = (int) downloadpic.getSize().getHeight();
int posx = X + offsetX/2;
int posy = Y + offsetY/2;
ai.AU3_MouseMove(posx, posy, 20);
ai.AU3_MouseClick("left", posx, posy, 1, 10);
Reference for my previous post on WebDriver and AutoIT: http://joychester.blogspot.com/2011/01/deal-with-file-download-in-webdriver-by.html
No comments:
Post a Comment