Revision history [back]

click to hide/show revision 1
initial version

answered 2011-11-17 02:51:17 +0800

matthewgo gravatar image matthewgo

Hi digulla, The following is a simple sample

                WebDriver driver = new FirefoxDriver();
            driver.get("URL");

            WebElement element = driver.findElement(By.id("zk_comp_5"));   // the input id

            Actions builder = new Actions(driver);

                //Use Keys.LEFT_CONTROL here
            builder.click(element).sendKeys(Keys.LEFT_CONTROL,"a").build().perform();   

                //zul alert is not a js alert, it calls Messagebox.show(); 
            //Alert alert = driver.switchTo().alert();

            //wait for the msgbox generated, or the selenium will execute faster than the browser;
            Thread.sleep(1000);
            //we need to find Element ourselves
            WebElement alertOK = driver.findElement(By.id("zk_comp_14")); //the OK button's ID in the msgbox  
            new Actions(driver).click(alertOK).build().perform();

            Thread.sleep(1000);
            builder.sendKeys(element, Keys.ENTER).perform();

For more information please refer to smalltalk

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More