当前位置: 首页>>代码示例>>Java>>正文


Java Keys.ALT属性代码示例

本文整理汇总了Java中org.openqa.selenium.Keys.ALT属性的典型用法代码示例。如果您正苦于以下问题:Java Keys.ALT属性的具体用法?Java Keys.ALT怎么用?Java Keys.ALT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.openqa.selenium.Keys的用法示例。


在下文中一共展示了Keys.ALT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dndWithCopy

public void dndWithCopy() throws Throwable {
    DesiredCapabilities caps = new DesiredCapabilities();
    // caps.setCapability("nativeEvents", true);
    driver = new JavaDriver(caps, caps);
    WebElement list = driver.findElement(By.cssSelector("list"));
    assertEquals(
            "[[\"List Item 0\",\"List Item 1\",\"List Item 2\",\"List Item 3\",\"List Item 4\",\"List Item 5\",\"List Item 6\",\"List Item 7\",\"List Item 8\",\"List Item 9\"]]",
            list.getAttribute("content"));
    WebElement listitem1 = driver.findElement(By.cssSelector("list::nth-item(1)"));
    WebElement listitem5 = driver.findElement(By.cssSelector("list::nth-item(5)"));
    listitem1.click();
    driver.clearlogs(LogType.DRIVER);
    Keys copyKey = Keys.ALT;
    if (Platform.isWindows()) {
        copyKey = Keys.CONTROL;
    }
    new Actions(driver).keyDown(copyKey).dragAndDrop(listitem1, listitem5).keyUp(copyKey).perform();
    waitTillDropCompletes(
            "[[\"List Item 0\",\"List Item 1\",\"List Item 2\",\"List Item 3\",\"List Item 0(1)\",\"List Item 5\",\"List Item 6\",\"List Item 7\",\"List Item 8\",\"List Item 9\"]]",
            list);
    assertEquals(
            "[[\"List Item 0\",\"List Item 1\",\"List Item 2\",\"List Item 3\",\"List Item 0(1)\",\"List Item 5\",\"List Item 6\",\"List Item 7\",\"List Item 8\",\"List Item 9\"]]",
            list.getAttribute("content"));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:DragAndDropTest.java

示例2: getMenuKey

public static Keys getMenuKey() {
    int keyMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    if (keyMask == Event.CTRL_MASK) {
        return Keys.CONTROL;
    }
    if (keyMask == Event.META_MASK) {
        return Keys.META;
    }
    if (keyMask == Event.ALT_MASK) {
        return Keys.ALT;
    }
    throw new WebDriverException("Unable to find the keymask... not control or meta?");
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:13,代码来源:OSUtils.java

示例3: getKeyCode

Keys getKeyCode(String data) {
    switch (data) {
        case "tab":
            return Keys.TAB;
        case "enter":
            return Keys.ENTER;
        case "shift":
            return Keys.SHIFT;
        case "ctrl":
            return Keys.CONTROL;
        case "alt":
            return Keys.ALT;
        case "esc":
            return Keys.ESCAPE;
        case "delete":
            return Keys.DELETE;
        case "backspace":
            return Keys.BACK_SPACE;
        case "home":
            return Keys.HOME;
        default:
            try {
                return Keys.valueOf(data.toUpperCase());
            } catch (Exception ex) {
                return null;
            }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:28,代码来源:CommonMethods.java


注:本文中的org.openqa.selenium.Keys.ALT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。