當前位置: 首頁>>代碼示例>>Java>>正文


Java Keys.CONTROL屬性代碼示例

本文整理匯總了Java中org.openqa.selenium.Keys.CONTROL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keys.CONTROL屬性的具體用法?Java Keys.CONTROL怎麽用?Java Keys.CONTROL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.openqa.selenium.Keys的用法示例。


在下文中一共展示了Keys.CONTROL屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: inspectElement

public void inspectElement(WebElement element) {
	keyCTRL = osName.startsWith("Mac") ? Keys.COMMAND : Keys.CONTROL;

	if (osName.startsWith("Mac")) {
		actions.keyDown(keyCTRL).build().perform();
		actions.moveToElement(element).contextClick().build().perform();
		actions.keyUp(keyCTRL).build().perform();
	} else {
		actions.moveToElement(element).build().perform();
		actions.keyDown(keyCTRL).contextClick().keyUp(keyCTRL).build().perform();
	}
	// Assert
	try {
		Thread.sleep(100);
	} catch (InterruptedException e) {
	}
}
 
開發者ID:sergueik,項目名稱:SWET,代碼行數:17,代碼來源:Utils.java

示例3: 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

示例4: listMultipleSelectWithControl

public void listMultipleSelectWithControl() throws Throwable {
    driver = new JavaDriver();
    WebElement listItem;
    listItem = driver.findElement(By.cssSelector("#list-1::nth-item(6)"));
    WebElement listItem2 = driver.findElement(By.cssSelector("#list-1::nth-item(3)"));
    WebElement listItem3 = driver.findElement(By.cssSelector("#list-1::nth-item(4)"));
    Keys command = Platform.getCurrent().is(Platform.MAC) ? Keys.COMMAND : Keys.CONTROL;
    new Actions(driver).click(listItem).sendKeys(command).click(listItem2).click(listItem3).sendKeys(command).perform();
    ArrayList<Integer> al = new ArrayList<Integer>();
    int[] selectedIndices = new int[] { 2, 3, 5 };
    for (int i : selectedIndices) {
        al.add(i);
    }
    assertEquals(al.toString(), driver.findElement(By.cssSelector("#list-1")).getAttribute("selectedIndices"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:JListXTest.java

示例5: 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

示例6: selectAdditionalRow

public void selectAdditionalRow(int index) {
    scrollToRowIndex(index);
    WebElement row = findRow(index);
    final Keys key = isPlatform(Platform.MAC) ? Keys.COMMAND : Keys.CONTROL;
    new Actions(getDriver()).keyDown(key).click(row).keyUp(key).perform();
    waitForPpr();
}
 
開發者ID:adfemg,項目名稱:adf-selenium,代碼行數:7,代碼來源:AdfTable.java


注:本文中的org.openqa.selenium.Keys.CONTROL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。