List of usage examples for org.openqa.selenium Keys ALT
Keys ALT
To view the source code for org.openqa.selenium Keys ALT.
Click Source Link
From source file:com.hp.test.framework.jelly.PressKeyonBrowserTag.java
@Override public void doTag(XMLOutput arg0) throws MissingAttributeException, JellyTagException { logger.info("Started Execution of PressKeyonBrowserTag"); WebDriver driver = getSelenium();//from w w w.j ava2s . co m try { Actions action = new Actions(driver); if (value.contains("+")) { String[] temp = value.split("\\+"); switch (temp[0].toUpperCase()) { case "CONTROL": action.sendKeys(Keys.chord(Keys.CONTROL, temp[1].toLowerCase())).build().perform(); break; case "ALT": action.sendKeys(Keys.chord(Keys.ALT, temp[1].toLowerCase())).build().perform(); break; } } else { action.sendKeys(Keys.valueOf(value)).build().perform(); } } catch (Exception e) { logger.error("Exception in the Pres Key on Browser" + "\n" + e.getMessage()); } logger.info("End of Execution of PressKeyonBrowserTag"); }
From source file:com.lazerycode.ebselen.CreateTestCode.java
License:Apache License
public String convertCommandToEbselenCode(String seleniumCommand, String target, String value) throws Exception { ideCommand command;//from w w w . java2 s .c o m try { command = ideCommand.valueOf(seleniumCommand.trim().toUpperCase()); } catch (Exception ex) { throw new IDECommandNotFoundException("Unable to match command to known list of commands!"); } //TODO remove variable below String testData = ""; switch (command) { case ADDLOCATIONSTRATEGY: case ADDLOCATIONSTRATEGYANDWAIT: return "LOGGER.warn(\"Custom locator strategies are not supported!\")"; case ADDSCRIPT: case ADDSCRIPTANDWAIT: // LOGGER.error("Function not implemented yet. Raise a request to get it implemented"); //TODO case ADDSELECTION: case ADDSELECTIONANDWAIT: return select.selectByVisibleText(target, value); case ALLOWNATIVEXPATH: case ALLOWNATIVEXPATHANDWAIT: return "LOGGER.warn(\"Modifying the XPath implementation mid test is not supported!\")"; case ALTKEYDOWN: case ALTKEYDOWNANDWAIT: return action.keyboard().pressKey(Keys.ALT); case ALTKEYUP: case ALTKEYUPANDWAIT: return action.keyboard().releaseKey(Keys.ALT); case ANSWERONNEXTPROMPT: return driver.switchTo().alert().sendKeys(target); case ASSERTALERT: return com.assertEquals(driver.switchTo().alert().getText(), value); case ASSERTALERTNOTPRESENT: //TODO case ASSERTALERTPRESENT: //TODO case ASSERTALLBUTTONS: //TODO case ASSERTALLFIELDS: //TODO case ASSERTALLLINKS: //TODO case ASSERTALLWINDOWIDS: //TODO case ASSERTALLWINDOWNAMES: //TODO case ASSERTALLWINDOWTITLES: //TODO case ASSERTATTRIBUTE: //TODO case ASSERTATTRIBUTEFROMALLWINDOWS: //TODO case ASSERTBODYTEXT: //TODO case ASSERTCHECKED: return com.assertTrue(ebselen.element().isChecked(target)); case ASSERTCONFIRMATION: //TODO case ASSERTCONFIRMATIONNOTPRESENT: //TODO case ASSERTCONFIRMATIONPRESENT: //TODO case ASSERTCOOKIE: //TODO case ASSERCOOKIEBYNAME: return com.assertEquals(driver.manage().getCookieNamed(target), value); case ASSERTCOOKIENOTPRESENT: //TODO case ASSERTCOOKIEPRESENT: //TODO case ASSERTCSSCOUNT: return com.assertEquals(driver.findElements(loc.locatorAsString(target)).size(), value); case ASSERTCURSORPOSITION: //TODO only for input element of textarea gets numerical position of cursor in field case ASSERTEDITABLE: return com.assertTrue(driver.findElement(loc.locatorAsString(target)).isEnabled()); case ASSERTELEMENTHEIGHT: return com.assertEquals(driver.findElement(loc.locatorAsString(target)).getCssValue("height"), value); case ASSERTELEMENTINDEX: //TODO case ASSERTELEMENTNOTPRESENT: return com.assertFalse(ebselen.element().doesElementExist(loc.locatorAsString(target))); case ASSERTELEMENTPOSITIONLEFT: //TODO case ASSERTELEMENTPOSITIONTOP: //TODO case ASSERTELEMENTPRESENT: return com.assertTrue(ebselen.element().doesElementExist(loc.locatorAsString(target))); case ASSETELEMENTWIDTH: return com.assertEquals(driver.findElement(loc.locatorAsString(target)).getCssValue("width"), value); case ASSERTEVAL: //TODO case ASSERTEXPRESSION: //TODO case ASSERTHTMLSOURCE: //TODO case ASSERTLOCATION: return com.assertEquals(driver.getCurrentUrl(), target); case ASSERTMOUSESPEED: //TODO case ASSERTNOTALERT: //TODO case ASSERTNOTALLBUTTONS: //TODO case ASSERTNOTALLFIELDS: //TODO case ASSERTNOTALLLINKS: //TODO case ASSERTNOTALLWINDOWIDS: //TODO case ASSERTNOTALLWINDOWNAMES: //TODO case ASSERTNOTALLWINDOWTITLES: //TODO case ASSERTNOTATTRIBUTE: //TODO case ASSERTNOTATTRIBUTEFROMALLWINDOWS: //TODO case ASSERTNOTBODYTEXT: //TODO case ASSERTNOTCHECKED: return com.assertFalse(ebselen.element().isChecked(target)); case ASSERTNOTCONFIRMATION: //TODO case ASSERTNOTCOOKIE: //TODO case ASSERTNOTCOOKIEBYNAME: //TODO case ASSERTNOTCSSCOUNT: return com.assertNotEquals(driver.findElements(loc.locatorAsString(target)).size(), value); case ASSERTNOTCURSORPOSITION: //TODO case ASSERTNOTEDITABLE: return com.assertFalse(driver.findElement(loc.locatorAsString(target)).isEnabled()); case ASSERTNOTELEMENTHEIGHT: //TODO case ASSERTNOTELEMENTINDEX: //TODO case ASSERTNOTELEMENTPOSITIONLEFT: //TODO case ASSERTNOTELEMENTPOSITIONTOP: //TODO case ASSERTNOTELEMENTWIDTH: //TODO case ASSERTNOTEVAL: //TODO case ASSERTNOTEXPRESSION: //TODO case ASSERTNOTHTMLSOURCE: //TODO case ASSERTNOTLOCATION: //TODO case ASSERTNOTMOUSESPEED: //TODO case ASSERTNOTORDERED: //TODO case ASSERTNOTPROMPT: //TODO case ASSERTNOTSELECTOPTIONS: //TODO case ASSERTNOTSELECTEDID: //TODO case ASSERTNOTSELECTEDIDS: //TODO case ASSERTNOTSELECTEDINDEX: //TODO case ASSERTNOTSELECTEDINDEXES: //TODO case ASSERTNOTSELECTELABEL: //TODO case ASSERTNOTSELECTEDLABELS: //TODO case ASSERTNOTSELECTEDVALUE: //TODO case ASSERTNOTSELECTEDVALUES: //TODO case ASSERTNOTSOMETHINGSELECTED: //TODO case ASSERTNOTSPEED: //TODO case ASSERTNOTTABLE: //TODO case ASSERTNOTTEXT: //TODO case ASSERTNOTTITLE: //TODO case ASSERTNOTVALUE: //TODO case ASSERTNOTVISIBLE: //TODO case ASSERTNOTWHETHERTHISFRAMEMATCHFRAMEEXPRESSION: //TODO case ASSERTNOTWHETHERTHISWINDOWMATCHWINDOWEXPRESSION: //TODO case ASSERTNOTXPATHCOUNT: return com.assertNotEquals(value, driver.findElements(loc.locatorAsString(target)).size()); case ASSERTORDERED: //TODO case ASSERTPROMPT: //TODO case ASSERTPROMPTNOTPRESENT: //TODO case ASSERTPROMPTPRESENT: //TODO case ASSERTSELECTOPTIONS: //TODO case ASSERTSELECTEDID: //TODO case ASSERTSELECTEDIDS: //TODO case ASSERTSELECTEDINDEX: //TODO case ASSERTSELECTEDINDEXES: //TODO case ASSERTSELECTEDLABEL: //TODO case ASSERTSELECTEDLABELS: //TODO case ASSERTSELECTEDVALUE: //TODO case ASSERTSELECTEDVALUES: //TODO case ASSERTSOMETHINGSELECTED: //TODO case ASSERTSPEED: //TODO case ASSERTTABLE: //TODO case ASSERTTEXT: return com.assertEquals(driver.findElement(loc.locatorAsString(target)).getText(), value); case ASSERTTEXTNOTPRESENT: testData += "assertFalse(isElementPresent(\"//*[contains(, '" + value + "')]\"));"; //TODO case ASSERTTEXTPRESENT: //TODO case ASSERTTITLE: return com.assertEquals(driver.findElement(loc.locatorAsString("tag=title")).getText(), value); case ASSERTVALUE: return com.assertEquals(value, driver.findElement(loc.locatorAsString(target)).getAttribute("value")); case ASSERTVISIBLE: return com.assertTrue(driver.findElement(loc.locatorAsString(target)).isDisplayed()); case ASSERTWHETHERTHISFRAMEMATCHEFRAMEEXPRESSION: //TODO case ASSERTWHETHERTHISWINDOWMATCHEWINDOWEXPRESSION: //TODO case ASSERTXPATHCOUNT: return com.assertEquals(value, driver.findElements(loc.locatorAsString(target)).size()); case ASSIGNID: case ASSIGNIDANDWAIT: return createWebElement(value, driver.findElement(loc.locatorAsString(target)).toString()); case CAPTUREENTIREPAGESCREENSHOT: case CAPTUREENTIREPAGESCREENSHOTANDWAIT: return ebselen.window().takeScreenshot(); case CHECK: case CHECKANDWAIT: return ebselen.element().check(target); case CHOOSECANCELONNEXTCONFIRMATION: // return driver.switchTo().alert().dismiss(); //TODO case CHOOSEOKONNEXTCONFIRMATION: case CHOOSEOKONNEXTCONFIRMATIONANDWAIT: // return driver.switchTo().alert().accept(); //TODO case CLICK: case CLICKANDWAIT: return driver.findElement(loc.locatorAsString(target)).click(); case CLICKAT: case CLICKATANDWAIT: action.mouse().click(coords(value, target)); case CLOSE: return driver.close(); case CONTEXTMENU: case CONTEXTMENUANDWAIT: return action.mouse().contextClick( returnCoordinates(driver.findElement(loc.locatorAsString(target)).getLocation().toString())); case CONTEXTMENUAT: case CONTEXTMENUATANDWAIT: return action.mouse().contextClick(coords(value, target)); case CREATECOOKIE: case CREATECOOKIEANDWAIT: // driver.manage().addCookie() //TODO case DELETEALLVISIBLECOOKIES: case DELETEALLVISIBLECOOKIESANDWAIT: return driver.manage().deleteAllCookies(); case DELETECOOKIE: case DELETECOOKIEANDWAIT: return driver.manage().deleteCookieNamed(target); case DESELECTPOPUP: case DESELECTPOPUPANDWAIT: return driver.switchTo().defaultContent(); case DOUBLECLICK: case DOUBLECLICKANDWAIT: return action.mouse().doubleClick( returnCoordinates(driver.findElement(loc.locatorAsString(target)).getLocation().toString())); case DOUBLECLICKAT: case DOUBLECLICKATANDWAIT: return action.mouse().doubleClick(coords(value, target)); case DRAGDROP: case DRAGANDDROP: case DRAGDROPANDWAIT: case DRAGANDDROPANDWAIT: String[] dragAndDropCoords = value.split(",", 1); String dragAndDropX = driver.findElement(loc.locatorAsString(target)).getLocation().getX() + "+" + dragAndDropCoords[0]; String dragAndDropY = driver.findElement(loc.locatorAsString(target)).getLocation().getY() + "+" + dragAndDropCoords[1]; // return action.builder().clickAndHold(driver.findElement(loc.locatorAsString(target))) // .moveByOffset(Integer.parseInt(coords[0]), Integer.parseInt(coords[1])).click();"; //TODO case DRAGANDDROPTOOBJECT: case DRAGANDDROPTOOBJECTANDWAIT: testData += "coords = value.split(\",\");" + "builder.clickAndHold(driver.findElement(" + loc.locatorAsString(target) + ")).moveByOffset(Integer.parseInt(coords[0]), Integer.parseInt(coords[1])).release(driver.findElement(" + loc.locatorAsString(value) + "));"; //TODO case ECHO: return "LOGGER.info(\"{}\", " + value + ");"; case FIREEVENT: case FIREEVENTANDWAIT: return ebselen.javascript().triggerJavascriptEvent(value, driver.findElement(loc.locatorAsString(target)).toString()); case FOCUS: case FOCUSANDWAIT: //TODO focus on the element found below //((Locatable) driver.findElement(" + loc.locatorAsString(target) + ")).getLocationOnScreenOnceScrolledIntoView(); case GOBACK: case GOBACKANDWAIT: return driver.navigate().back(); case HIGHLIGHT: case HIGHLIGHTANDWAIT: //TODO case IGNOREATTRIBUTESWITHOUTVALUE: case IGNOREATTRIBUTESWITHOUTVALUEANDWAIT: //TODO case KEYDOWN: case KEYDOWNANDWAIT: return action.builder().keyDown(driver.findElement(loc.locatorAsString(target)).toString(), Keys.valueOf(value)); case KEYPRESS: case KEYPRESSANDWAIT: return driver.findElement(loc.locatorAsString(target)).sendKeys(value); case KEYUP: case KEYUPANDWAIT: return action.builder().keyUp(driver.findElement(loc.locatorAsString(target)).toString(), Keys.valueOf(value)); case METAKEYDOWN: case METAKEYDOWNANDWAIT: return action.builder().keyDown(driver.findElement(loc.locatorAsString(target)).toString(), Keys.META); case METAKEYUP: case METAKEYUPANDWAIT: return action.builder().keyUp(driver.findElement(loc.locatorAsString(target)).toString(), Keys.META); case MOUSEDOWN: case MOUSEDOWNANDWAIT: return action.mouse().mouseDown( returnCoordinates(driver.findElement(loc.locatorAsString(target)).getLocation().toString())); case MOUSEDOWNAT: case MOUSEDOWNATANDWAIT: return action.mouse().mouseDown(coords(value, target)); case MOUSEDOWNRIGHT: case MOUSEDOWNRIGHTANDWAIT: //return action.mouse().("(Coordinates)" + driver.findElement(loc.locatorAsString(target)).getLocation()); //TODO likemousedown but with context case MOUSEDOWNRIGHTAT: case MOUSEDOWNRIGHTATANDWAIT: //TODO case MOUSEMOVE: case MOUSEMOVEANDWAIT: return action.mouse().mouseMove( returnCoordinates(driver.findElement(loc.locatorAsString(target)).getLocation().toString())); case MOUSEMOVEAT: case MOUSEMOVEATANDWAIT: return action.mouse().mouseMove(coords(value, target)); case MOUSEOUT: case MOUSEOUTANDWAIT: //TODO case MOUSEOVER: case MOUSEOVERANDWAIT: return action.mouse().mouseMove( returnCoordinates(driver.findElement(loc.locatorAsString(target)).getLocation().toString())); case MOUSEUP: case MOUSEUPANDWAIT: return action.mouse().mouseUp( returnCoordinates(driver.findElement(loc.locatorAsString(target)).getLocation().toString())); case MOUSEUPAT: case MOUSEUPATANDWAIT: return action.mouse().mouseUp(coords(value, target)); case MOUSEUPRIGHT: case MOUSEUPRIGHTANDWAIT: //TODO case MOUSEUPRIGHTAT: case MOUSEUPRIGHTATANDWAIT: //TODO case OPEN: return driver.get(target); case OPENWINDOW: case OPENWINDOWANDWAIT: //TODO case PAUSE: return "Thread.sleep((long) Integer.parseInt(" + value + "));"; case REFRESH: case REFRESHANDWAIT: return driver.navigate().refresh(); case REMOVEALLSELECTIONS: case REMOVEALLSELECTIONSANDWAIT: return select.deselectAll(target); case REMOVESCRIPT: case REMOVESCRIPTANDWAIT: //TODO case REMOVESELECTION: case REMOVESELECTIONANDWAIT: return select.deselectByVisibleText(target, value); case ROLLUP: case ROLLUPANDWAIT: //TODO case RUNSCRIPT: case RUNSCRIPTANDWAIT: //TODO case SELECT: case SELECTANDWAIT: return select.selectByVisibleText(target, value); case SELECTFRAME: return driver.switchTo().frame(driver.findElement(loc.locatorAsString(target)).toString()); case SELECTPOPUP: case SELECTPOPUPANDWAIT: //TODO case SELECTWINDOW: //TODO case SETBROWSERLOGLEVEL: case SETBROWSERLOGLEVELANDWAIT: return "LOGGER.warn(\"Modifying the Log Level mid test is not supported!\")"; case SETMOUSESPEED: case SETMOUSESPEEDANDWAIT: //TODO case SETSPEED: case SETSPEEDANDWAIT: //TODO case SETTIMEOUT: return driver.manage().timeouts().setScriptTimeout(Long.parseLong(value), TimeUnit.MILLISECONDS); case SHIFTKEYDOWN: case SHIFTKEYDOWNANDWAIT: return action.keyboard().pressKey(Keys.SHIFT); case SHIFTKEYUP: case SHIFTKEYUPANDWAIT: return action.keyboard().releaseKey(Keys.SHIFT); case STORE: return store(value, target); case STOREALERT: return store(value, driver.switchTo().alert().getText()); case STOREALERTPRESENT: testData += "boolean alertVisible = false;" + "try {" + "driver.switchTo().alert();" + "alertVisible = true;" + "} catch (Exception Ex) {" + "//Alert doesn't exist" + "}" + "storedVariables.put(" + value + ", alertVisible);"; //TODO case STOREALLBUTTONS: //TODO check implementation... The IDE implementation stores ID's, not Elements return store(value, driver.findElements(loc.locatorAsString("(//input[@type='button'])|(//button)")).toString()); case STOREALLFIELDS: //TODO check implementation... The IDE implementation stores ID's, not Elements //TODO check if this should just be input[@type='text'] or textarea as well? return store(value, driver.findElements(loc.locatorAsString("//input[@type='text']")).toString()); case STOREALLLINKS: //TODO check implementation... The IDE implementation stores ID's, not Elements return store(value, driver.findElements(loc.locatorAsString("tag=a")).toString()); case STOREALLWINDOWIDS: case STOREALLWINDOWNAMES: case STOREALLWINDOWTITLES: return store(value, driver.getWindowHandles()); case STOREATTRIBUTE: String[] locatorDetails = target.split("@", 1); return store(value, driver.findElement(loc.locatorAsString(locatorDetails[0])).getAttribute(locatorDetails[1])); case STOREATTRIBUTEFROMALLWINDOWS: //TODO case STOREBODYTEXT: return store(value, driver.findElement(loc.locatorAsString("tag=body")).getText()); case STORECHECKED: return store(value, ebselen.element().isChecked(target)); case STORECONFIRMATION: //TODO case STORECONFIRMATIONPRESENT: //TODO case STORECOOKIE: //TODO case STORECOOKIEBYNAME: //TODO case STORECOOKIEPRSENT: //TODO case STORECSSCOUNT: return store(value, driver.findElements(loc.locatorAsString(target)).size()); case STORECURSORPOSITION: //TODO case STOREEDITABLE: return store(value, driver.findElement(loc.locatorAsString(target)).isEnabled()); case STOREELEMENTHEIGHT: return store(value, driver.findElement(loc.locatorAsString(target)).getSize().getHeight()); case STOREELEMENTINDEX: //TODO case STOREELEMENTPOSITIONLEFT: //TODO case STOREELEMENTPOSITIONTOP: //TODO case STOREELEMENTPRESENT: return store(value, ebselen.element().doesElementExist(loc.locatorAsString(target))); case STOREELEMENTWIDTH: return store(value, driver.findElement(loc.locatorAsString(target)).getSize().getWidth()); case STOREEVAL: //TODO case STOREEXPRESSION: //TODO case STOREHTMLSOURCE: return store(value, driver.getPageSource()); case STORELOCATION: return store(value, driver.getCurrentUrl()); case STOREMOUSESPEED: //TODO case STOREORDERED: //TODO case STOREPROMPT: //TODO case STOREPROMPTPRESENT: //TODO case STORESELECTOPTIONS: //TODO case STORESELECTEDID: //TODO case STORESELECTEDIDS: //TODO case STORESELECTEDINDEX: //TODO case STORESELECTEDINDEXES: //TODO case STORESELECTEDLABEL: //TODO case STORESELECTEDLABELS: //TODO case STORESELECTEDVALUE: //TODO case STORESELECTEDVALUES: //TODO case STORESOMETHINGSELECTED: //TODO case STORESPEED: //TODO case STORETABLE: //TODO case STORETEXT: //TODO case STORETEXTPRESENT: //TODO case STORETITLE: //TODO case STOREVALUE: //TODO case STOREVISIBLE: //TODO case STOREWHETHERTHISFRAMEMATCHFRAMEEXPRESSION: //TODO case STOREWHETHERTHISWINDOWMATCHWINDOWEXPRESSION: //TODO case STOREXPATHCOUNT: return store(value, driver.findElements(loc.locatorAsString(target)).size()); case SUBMIT: case SUBMITANDWAIT: driver.findElement(loc.locatorAsString(target)).submit(); case TYPE: case TYPEANDWAIT: case TYPEKEYS: case TYPEKEYSANDWAIT: return driver.findElement(loc.locatorAsString(target)).sendKeys(value); case UNCHECK: case UNCHECKANDWAIT: return ebselen.element().uncheck(target); case USEXPATHLIBRARY: case USEXPATHLIBRARYANDWAIT: //TODO case VERIFYALERT: return com.verifyEquals(driver.switchTo().alert().getText(), value); case VERIFYALERTNOTPRESENT: //TODO case VERIFYALERTPRESENT: //TODO case VERIFYALLBUTTONS: //TODO case VERIFYALLFIELDS: //TODO case VERIFYALLLINKS: //TODO case VERIFYALLWINDOWIDS: //TODO case VERIFYALLWINDOWNAMES: //TODO case VERIFYALLWINDOWTITLES: //TODO case VERIFYATTRIBUTE: //TODO case VERIFYATTRIBUTEFROMALLWINDOWS: //TODO case VERIFYBODYTEXT: //TODO case VERIFYCHECKED: return com.verifyTrue(com.assertFalse(ebselen.element().isChecked(target))); case VERIFYCONFIRMATION: //TODO case VERIFYCONFIRMATIONNOTPRESENT: //TODO case VERIFYCONFIRMATIONPRESENT: //TODO case VERIFYCOOKIE: //TODO case VERIFYCOOKIEBYNAME: //TODO case VERIFYCOOKIENOTPRESENT: //TODO case VERIFYCOOKIEPRESENT: //TODO case VERIFYCSSCOUNT: return com.verifyEquals(driver.findElements(loc.locatorAsString(target)).size(), value); case VERIFYCURSORPOSITION: //TODO case VERIFYEDITABLE: return com.verifyTrue(driver.findElement(loc.locatorAsString(target)).isEnabled()); case VERIFYELEMENTHEIGHT: return com.verifyEquals(driver.findElement(loc.locatorAsString(target)).getCssValue("height"), value); case VERIFYELEMENTINDEX: //TODO case VERIFYELEMENTNOTPRESENT: return com.verifyFalse(ebselen.element().doesElementExist(loc.locatorAsString(target))); case VERIFYELEMENTPOSITIONLEFT: //TODO case VERIFYELEMENTPOSITIONTOP: //TODO case VERIFYELEMENTPRESENT: return com.verifyTrue(ebselen.element().doesElementExist(loc.locatorAsString(target))); case VERIFYELEMENTWIDTH: return com.verifyEquals(driver.findElement(loc.locatorAsString(target)).getCssValue("width"), value); case VERIFYEVAL: //TODO case VERIFYEXPRESSION: //TODO case VERIFYHTMLSOURCE: //TODO case VERIFYLOCATION: //TODO case VERIFYMOUSESPEED: //TODO case VERIFYNOTALERT: //TODO case VERIFYNOTALLBUTTONS: //TODO case VERIFYNOTALLFIELDS: //TODO case VERIFYNOTALLLINKS: //TODO case VERIFYNOTALLWINDOWIDS: //TODO case VERIFYNOTALLWINDOWNAMES: //TODO case VERIFYNOTALLWINDOWTITLES: //TODO case VERIFYNOTATTRIBUTE: //TODO case VERIFYNOTATTRIBUTEFROMALLWINDOWS: //TODO case VERIFYNOTBODYTEXT: //TODO case VERIFYNOTCHECKED: return com.verifyFalse(com.assertFalse(ebselen.element().isChecked(target))); case VERIFYNOTCONFIRMATION: //TODO case VERIFYNOTCOOKIE: //TODO case VERIFYNOTCOOKIEBYNAME: //TODO case VERIFYNOTCSSCOUNT: return com.verifyNotEquals(driver.findElements(loc.locatorAsString(target)).size(), value); case VERIFYNOTCURSORPOSITION: //TODO case VERIFYNOTEDITABLE: return com.verifyFalse(driver.findElement(loc.locatorAsString(target)).isEnabled()); case VERIFYNOTELEMENTHEIGHT: return com.verifyNotEquals(driver.findElement(loc.locatorAsString(target)).getCssValue("height"), value); case VERIFYNOTELEMENTINDEX: //TODO case VERIFYNOTELEMENTPOSITIONLEFT: //TODO case VERIFYNOTELEMENTPOSITIONTOP: //TODO case VERIFYNOTELEMENTWIDTH: return com.verifyNotEquals(driver.findElement(loc.locatorAsString(target)).getCssValue("width"), value); case VERIFYNOTEVAL: //TODO case VERIFYNOTEXPRESSION: //TODO case VERIFYNOTHTMLSOURCE: //TODO case VERIFYNOTLOCATION: //TODO case VERIFYNOTMOUSESPEED: //TODO case VERIFYNOTORDERED: //TODO case VERIFYNOTPROMPT: //TODO case VERIFYNOTSELECTOPTIONS: //TODO case VERIFYNOTSELECTEDID: //TODO case VERIFYNOTSELECTEDIDS: //TODO case VERIFYNOTSELECTEDINDEX: //TODO case VERIFYNOTSELECTEDINDEXES: //TODO case VERIFYNOTSELECTEDLABEL: //TODO case VERIFYNOTSELECTEDLABELS: //TODO case VERIFYNOTSELECTEDVALUE: //TODO case VERIFYNOTSELECTEDVALUES: //TODO case VERIFYNOTSOMTHINGSELECTED: //TODO case VERIFYNOTSPEED: //TODO case VERIFYNOTTABLE: //TODO case VERIFYNOTTEXT: //TODO case VERIFYNOTTITLE: //TODO case VERIFYNOTVALUE: //TODO case VERIFYNOTVISIBLE: //TODO case VERIFYNOTWHETHERTHISFRAMEMATCHFRAMEEXPRESSION: //TODO case VERIFYNOTWHETHERTHISWINDOWMATCHWINDOWEXPRESSION: //TODO case VERIFYNOTXPATHCOUNT: return com.verifyNotEquals(value, driver.findElements(loc.locatorAsString(target)).size()); case VERIFYORDERED: //TODO case VERIFYPROMPT: //TODO case VERIFYPROMPTNOTPRESENT: //TODO case VERIFYPROMPTPRESENT: //TODO case VERIFYSELECTOPTIONS: //TODO case VERIFYSELECTEDID: //TODO case VERIFYSELECTEDIDS: //TODO case VERIFYSELECTEDINDEX: //TODO case VERIFYSELECTEDINDEXES: //TODO case VERIFYSELECTEDLABEL: //TODO case VERIFYSELECTEDLABELS: //TODO case VERIFYSELECTEDVALUE: //TODO case VERIFYSELECTEDVALUES: //TODO case VERIFYSOMETHINGSELECTED: //TODO case VERIFYSPEED: //TODO case VERIFYTABLE: //TODO case VERIFYTEXT: //TODO case VERIFYTEXTNOTPRESENT: return com.verifyFalse( ebselen.element().doesElementExist(loc.locatorAsString("//*[contains(, '" + value + "')]"))); case VERIFYTEXTPRESENT: return com.verifyTrue( ebselen.element().doesElementExist(loc.locatorAsString("//*[contains(, '" + value + "')]"))); case VERIFYTITLE: //TODO case VERIFYVALUE: //TODO case VERIFYVISIBLE: //TODO case VERIFYWHETHERTHISFRAMEMATCHFRAMEEXPRESSION: //TODO case VERIFYWHETHERTHISWINDOWMATCHWINDOWEXPRESSION: //TODO case VERIFYXPATHCOUNT: return com.verifyEquals(value, driver.findElements(loc.locatorAsString(target)).size()); case WAITFORALERT: //TODO case WAITFORALERTNOTPRESENT: //TODO case WAITFORALERTPRESENT: //TODO case WAITFORALLBUTTONS: //TODO case WAITFORALLFIELDS: //TODO case WAITFORALLLINKS: //TODO case WAITFORALLWINDOWIDS: //TODO case WAITFORALLWINDOWNAMES: //TODO case WAITFORALLWINDOWTITLES: //TODO case WAITFORATTRIBUTE: //TODO case WAITFORATTRIBUTEFROMALLWINDOWS: //TODO case WAITFORBODYTEXT: //TODO case WAITFORCHECKED: //TODO case WAITFORCONDITION: //TODO case WAITFORCONFIRMATION: //TODO case WAITFORCONFIRMATIONNOTPRESENT: //TODO case WAITFORCONFIRMATIONPRESENT: //TODO case WAITFORCOOKIE: //TODO case WAITFORCOOKIEBYNAME: //TODO case WAITFORCOOKIENOTPRESENT: //TODO case WAITFORCOOKIEPRESENT: //TODO case WAITFORCSSCOUNT: //TODO case WAITFORCURSORPOSITION: //TODO case WAITFOREDITABLE: //TODO case WAITFORELEMENTHEIGHT: //TODO case WAITFORELEMENTINDEX: //TODO case WAITFORELEMENTNOTPRESENT: //TODO case WAITFORELEMENTPOSITIONLEFT: //TODO case WAITFORELEMENTPOSITIONTOP: //TODO case WAITFORELEMENTPRESENT: //TODO case WAITFORELEMENTWIDTH: //TODO case WAITFOREVAL: //TODO case WAITFOREXPRESSION: //TODO case WAITFORFRAMETOLOAD: //TODO case WAITFORHTMLSOURCE: //TODO case WAITFORLOCATION: //TODO case WAITFORMOUSESPEED: //TODO case WAITFORNOTALERT: //TODO case WAITFORNOTALLBUTTONS: //TODO case WAITFORNOTALLFIELDS: //TODO case WAITFORNOTALLLINKS: //TODO case WAITFORNOTALLWINDOWIDS: //TODO case WAITFORNOTALLWINDOWNAMES: //TODO case WAITFORNOTALLWINDOWTITLES: //TODO case WAITFORNOTATTRIBUTE: //TODO case WAITFORNOTATTRIBUTEFROMALLWINDOWS: //TODO case WAITFORNOTBODYTEXT: //TODO case WAITFORNOTCHECKED: //TODO case WAITFORNOTCONFIRMATION: //TODO case WAITFORNOTCOOKIE: //TODO case WAITFORNOTCOOKIEBYNAME: //TODO case WAITFORNOTCSSCOUNT: //TODO case WAITFORNOTCURSORPOSITION: //TODO case WAITFORNOTEDITABLE: //TODO case WAITFORNOTELEMENTHEIGHT: //TODO case WAITFORNOTELEMENTINDEX: //TODO case WAITFORNOTELEMENTPOSITIONLEFT: //TODO case WAITFORNOTELEMENTPOSITIONTOP: //TODO case WAITFORNOTELEMENTWIDTH: //TODO case WAITFORNOTEVAL: //TODO case WAITFORNOTEXPRESSION: //TODO case WAITFORNOTHTMLSOURCE: //TODO case WAITFORNOTLOCATION: //TODO case WAITFORNOTMOUSESPEED: //TODO case WAITFORNOTORDERED: //TODO case WAITFORNOTPROMPT: //TODO case WAITFORNOTSELECTOPTIONS: //TODO case WAITFORNOTSELECTEDID: //TODO case WAITFORNOTSELECTEDIDS: //TODO case WAITFORNOTSELECTEDINDEX: //TODO case WAITFORNOTSELECTEDINDEXES: //TODO case WAITFORNOTSELECTEDLABEL: //TODO case WAITFORNOTSELECTEDLABELS: //TODO case WAITFORNOTSELECTEDVALUE: //TODO case WAITFORNOTSELECTEDVALUES: //TODO case WAITFORNOTSOMETHINGSELECTED: //TODO case WAITFORNOTSPEED: //TODO case WAITFORNOTTABLE: //TODO case WAITFORNOTTEXT: //TODO case WAITFORNOTTITLE: //TODO case WAITFORNOTVALUE: //TODO case WAITFORNOTVISIBLE: //TODO case WAITFORNOTWHETHERTHISFRAMEMATCHFRAMEEXPRESSION: //TODO case WAITFORNOTWHETHERTHISWINDOWMATCHWINDOWEXPRESSION: //TODO case WAITFORNOTXPATHCOUNT: //TODO case WAITFORORDERED: //TODO case WAITFORPAGETOLOAD: //TODO case WAITFORPOPUP: //TODO case WAITFORPROMPT: //TODO case WAITFORPROMPTNOTPRESENT: //TODO case WAITFORPROMPTPRESENT: //TODO case WAITFORSELECTOPTIONS: //TODO case WAITFORSELECTEDID: //TODO case WAITFORSELECTEDIDS: //TODO case WAITFORSELECTEDINDEX: //TODO case WAITFORSELECTEDINDEXES: //TODO case WAITFORSELECTEDLABEL: //TODO case WAITFORSELECTEDLABELS: //TODO case WAITFORSELECTEDVALUE: //TODO case WAITFORSELECTEDVALUES: //TODO case WAITFORSOMETHINGSELECTED: //TODO case WAITFORSPEED: //TODO case WAITFORTABLE: //TODO case WAITFORTEXT: //TODO case WAITFORTEXTNOTPRESENT: //TODO check implementation return ebselen.waiting().untilWebElement(loc.locatorAsString("//*[contains(., '" + target + "')]")) .doesNotExist(); case WAITFORTEXTPRESENT: //TODO check implementation return ebselen.waiting().untilWebElement(loc.locatorAsString("//*[contains(., '" + target + "')]")) .exists(); case WAITFORTITLE: //TODO case WAITFORVALUE: //wait for a value, returns value or on/off for checkbox/radio elements //TODO case WAITFORVISIBLE: //TODO case WAITFORWHETERTHISFRAMEMATCHFRAMEEXPRESSION: //TODO case WAITFORWHETERTHISWINDOWMATCHWINDOWEXPRESSION: //TODO case WAITFORXPATHCOUNT: //TODO case WINDOWFOCUS: case WINDOWFOCUSANDWAIT: //TODO case WINDOWMAXIMIZE: case WINDOWMAXIMIZEANDWAIT: //TODO default: throw new IDECommandNotFoundException(); } }
From source file:com.mkl.websuites.internal.command.impl.key.PressCommand.java
License:Apache License
private Keys keyFromModifier(String key) { switch (key) { case "CTRL": return Keys.CONTROL; case "ALT": return Keys.ALT; case "SHIFT": return Keys.SHIFT; default:// w w w. j a v a 2s . co m return null; } }
From source file:com.thoughtworks.selenium.webdriven.commands.SendKeys.java
License:Apache License
@Override protected Void handleSeleneseCommand(WebDriver driver, String locator, String value) { alertOverride.replaceAlertMethod(driver); value = value.replace("${KEY_ALT}", Keys.ALT); value = value.replace("${KEY_CONTROL}", Keys.CONTROL); value = value.replace("${KEY_CTRL}", Keys.CONTROL); value = value.replace("${KEY_META}", Keys.META); value = value.replace("${KEY_COMMAND}", Keys.COMMAND); value = value.replace("${KEY_SHIFT}", Keys.SHIFT); value = value.replace("${KEY_BACKSPACE}", Keys.BACK_SPACE); value = value.replace("${KEY_BKSP}", Keys.BACK_SPACE); value = value.replace("${KEY_DELETE}", Keys.DELETE); value = value.replace("${KEY_DEL}", Keys.DELETE); value = value.replace("${KEY_ENTER}", Keys.ENTER); value = value.replace("${KEY_EQUALS}", Keys.EQUALS); value = value.replace("${KEY_ESCAPE}", Keys.ESCAPE); value = value.replace("${KEY_ESC}", Keys.ESCAPE); value = value.replace("${KEY_INSERT}", Keys.INSERT); value = value.replace("${KEY_INS}", Keys.INSERT); value = value.replace("${KEY_PAUSE}", Keys.PAUSE); value = value.replace("${KEY_SEMICOLON}", Keys.SEMICOLON); value = value.replace("${KEY_SPACE}", Keys.SPACE); value = value.replace("${KEY_TAB}", Keys.TAB); value = value.replace("${KEY_LEFT}", Keys.LEFT); value = value.replace("${KEY_UP}", Keys.UP); value = value.replace("${KEY_RIGHT}", Keys.RIGHT); value = value.replace("${KEY_DOWN}", Keys.DOWN); value = value.replace("${KEY_PAGE_UP}", Keys.PAGE_UP); value = value.replace("${KEY_PGUP}", Keys.PAGE_UP); value = value.replace("${KEY_PAGE_DOWN}", Keys.PAGE_DOWN); value = value.replace("${KEY_PGDN}", Keys.PAGE_DOWN); value = value.replace("${KEY_END}", Keys.END); value = value.replace("${KEY_HOME}", Keys.HOME); value = value.replace("${KEY_NUMPAD0}", Keys.NUMPAD0); value = value.replace("${KEY_N0}", Keys.NUMPAD0); value = value.replace("${KEY_NUMPAD1}", Keys.NUMPAD1); value = value.replace("${KEY_N1}", Keys.NUMPAD1); value = value.replace("${KEY_NUMPAD2}", Keys.NUMPAD2); value = value.replace("${KEY_N2}", Keys.NUMPAD2); value = value.replace("${KEY_NUMPAD3}", Keys.NUMPAD3); value = value.replace("${KEY_N3}", Keys.NUMPAD3); value = value.replace("${KEY_NUMPAD4}", Keys.NUMPAD4); value = value.replace("${KEY_N4}", Keys.NUMPAD4); value = value.replace("${KEY_NUMPAD5}", Keys.NUMPAD5); value = value.replace("${KEY_N5}", Keys.NUMPAD5); value = value.replace("${KEY_NUMPAD6}", Keys.NUMPAD6); value = value.replace("${KEY_N6}", Keys.NUMPAD6); value = value.replace("${KEY_NUMPAD7}", Keys.NUMPAD7); value = value.replace("${KEY_N7}", Keys.NUMPAD7); value = value.replace("${KEY_NUMPAD8}", Keys.NUMPAD8); value = value.replace("${KEY_N8}", Keys.NUMPAD8); value = value.replace("${KEY_NUMPAD9}", Keys.NUMPAD9); value = value.replace("${KEY_N9}", Keys.NUMPAD9); value = value.replace("${KEY_ADD}", Keys.ADD); value = value.replace("${KEY_NUM_PLUS}", Keys.ADD); value = value.replace("${KEY_DECIMAL}", Keys.DECIMAL); value = value.replace("${KEY_NUM_PERIOD}", Keys.DECIMAL); value = value.replace("${KEY_DIVIDE}", Keys.DIVIDE); value = value.replace("${KEY_NUM_DIVISION}", Keys.DIVIDE); value = value.replace("${KEY_MULTIPLY}", Keys.MULTIPLY); value = value.replace("${KEY_NUM_MULTIPLY}", Keys.MULTIPLY); value = value.replace("${KEY_SEPARATOR}", Keys.SEPARATOR); value = value.replace("${KEY_SEP}", Keys.SEPARATOR); value = value.replace("${KEY_SUBTRACT}", Keys.SUBTRACT); value = value.replace("${KEY_NUM_MINUS}", Keys.SUBTRACT); value = value.replace("${KEY_F1}", Keys.F1); value = value.replace("${KEY_F2}", Keys.F2); value = value.replace("${KEY_F3}", Keys.F3); value = value.replace("${KEY_F4}", Keys.F4); value = value.replace("${KEY_F5}", Keys.F5); value = value.replace("${KEY_F6}", Keys.F6); value = value.replace("${KEY_F7}", Keys.F7); value = value.replace("${KEY_F8}", Keys.F8); value = value.replace("${KEY_F9}", Keys.F9); value = value.replace("${KEY_F10}", Keys.F10); value = value.replace("${KEY_F11}", Keys.F11); value = value.replace("${KEY_F12}", Keys.F12); finder.findElement(driver, locator).sendKeys(value); return null;//from ww w . j a v a 2 s. c om }
From source file:org.eclipse.che.selenium.assistant.KeyBindingsTest.java
License:Open Source License
@Test public void enterKeyCombinationTest() throws Exception { projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); notificationsPopupPanel.waitProgressPopupPanelClose(); loader.waitOnClosed();/*from w ww . j a va 2 s . co m*/ keyBindings.enterKeyCombination(Keys.CONTROL, Keys.ALT, Keys.getKeyFromUnicode('n')); navigateToFile.waitFormToOpen(); navigateToFile.closeNavigateToFileForm(); keyBindings.enterKeyCombination(Keys.ALT, Keys.F12); terminal.waitTerminalTab(); WaitUtils.sleepQuietly(1); consoles.closeTerminalIntoConsoles(); consoles.closeProcessesArea(); }
From source file:org.eclipse.che.selenium.git.GitPanelTest.java
License:Open Source License
@Test(priority = 13, enabled = false) public void shouldOpenGitPanelWithHotKey() { assertEquals(gitPanel.countRepositories(), 2); projectExplorer.openAndWait();/* w ww . j a v a 2s .c om*/ seleniumWebDriver.navigate().refresh(); projectExplorer.waitProjectExplorer(); seleniumWebDriver.findElement(By.id("gwt-debug-projectTree")).sendKeys(Keys.ALT + "g"); gitPanel.waitRepositories(2); gitPanel.waitRepositoryToBeClean(NODE_JS_GIT_PROJECT_NAME); gitPanel.waitRepositoryToHaveChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, 1); projectExplorer.openAndWait(); projectExplorer.waitProjectExplorer(); seleniumWebDriver.findElement(By.id("gwt-debug-projectTree")).sendKeys(Keys.ALT + "g"); gitPanel.waitRepositories(2); gitPanel.waitRepositoryToBeClean(NODE_JS_GIT_PROJECT_NAME); gitPanel.waitRepositoryToHaveChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, 1); }
From source file:org.eclipse.che.selenium.miscellaneous.CheckCreatingProjectInEmptyWsTest.java
License:Open Source License
@Test public void checkImportAndCreatingFromProjectExplorer() throws InterruptedException { loader.waitOnClosed();// w ww . j a va2s . co m projectExplorer.clickOnCreateProjectLink(10); wizard.closeWithIcon(); projectExplorer.clickOnEmptyAreaOfProjectTree(1); projectExplorer.clickOnImportProjectLink(1); importProjectFromLocation.closeWithIcon(); projectExplorer.clickOnEmptyAreaOfProjectTree(1); try { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + "x").perform(); wizard.closeWithIcon(); } catch (org.openqa.selenium.TimeoutException e) { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + "x").perform(); wizard.closeWithIcon(); } projectExplorer.clickOnEmptyAreaOfProjectTree(1); try { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") .perform(); importProjectFromLocation.closeWithIcon(); } catch (org.openqa.selenium.TimeoutException e) { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") .perform(); importProjectFromLocation.closeWithIcon(); } }
From source file:org.eclipse.che.selenium.miscellaneous.CheckCreatingProjectInEmptyWsTest.java
License:Open Source License
@Test(priority = 1) public void checkImportAndCreatingFromEditorPanel() { WebDriverWait waitForWebElements = new WebDriverWait(ide.driver(), LOAD_PAGE_TIMEOUT_SEC); String locatorToEditorContaiPaineId = "//div[@id='gwt-debug-editorMultiPartStack-contentPanel']"; String locatorToImportProjectLnk = locatorToEditorContaiPaineId + "//div[text()='Import Project...']"; String locatorToCreateProjectLnk = locatorToEditorContaiPaineId + "//div[text()='Create Project...']"; loader.waitOnClosed();//from w ww . j a va 2 s.c o m waitForWebElements.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToImportProjectLnk))) .click(); importProjectFromLocation.closeWithIcon(); waitForWebElements.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToCreateProjectLnk))) .click(); wizard.closeWithIcon(); waitForWebElements .until(ExpectedConditions.visibilityOfElementLocated((By.xpath(locatorToEditorContaiPaineId)))) .click(); try { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + "x").perform(); wizard.closeWithIcon(); } catch (org.openqa.selenium.TimeoutException e) { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + "x").perform(); wizard.closeWithIcon(); } waitForWebElements.until( ExpectedConditions.visibilityOf(ide.driver().findElement(By.xpath(locatorToEditorContaiPaineId)))) .click(); try { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") .perform(); importProjectFromLocation.closeWithIcon(); } catch (org.openqa.selenium.TimeoutException e) { actionsFactory.createAction(ide.driver()).sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") .perform(); importProjectFromLocation.closeWithIcon(); } }
From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java
License:Open Source License
@Override public void pressKey(Key key) { switch (key) { case Shift:/* w ww . ja v a 2 s .com*/ m_actionBuilder.keyDown(Keys.SHIFT); m_modifierPressed = true; break; case Control: m_actionBuilder.keyDown(Keys.CONTROL); // m_bot.controlKeyDown(); // m_bot.keyDownNative("17"); // m_keyList.add(Keys.CONTROL); m_modifierPressed = true; break; case Alt: m_actionBuilder.keyDown(Keys.ALT); m_modifierPressed = true; break; case Windows: m_actionBuilder.keyDown(Keys.META); m_modifierPressed = true; break; default: m_actionBuilder.sendKeys(toSeleniumKey(key).toString()); m_actionBuilder.perform(); // m_bot.keyDown(m_currentWidgetId, toSeleniumKey(key)); waitForIdle(); break; } }
From source file:org.eclipse.scout.rt.testing.ui.rap.RapMock.java
License:Open Source License
@Override public void releaseKey(Key key) { switch (key) { case Shift:/* w w w.j a v a 2 s . co m*/ m_actionBuilder.keyUp(Keys.SHIFT); m_modifierPressed = false; break; case Control: m_actionBuilder.keyUp(Keys.CONTROL); // m_bot.controlKeyUp(); // m_bot.keyUpNative("17"); // getCurrentElement().sendKeys(m_keyList.toArray(new CharSequence[m_keyList.size()])); // m_keyList.clear(); // getCurrentElement().sendKeys(Keys.CONTROL, "a"); m_modifierPressed = false; break; case Alt: m_actionBuilder.keyUp(Keys.ALT); m_modifierPressed = false; break; case Windows: m_actionBuilder.keyUp(Keys.META); m_modifierPressed = false; break; default: m_actionBuilder.keyUp(toSeleniumKey(key)); // m_bot.keyUp(m_currentWidgetId, toSeleniumKey(key)); break; } m_actionBuilder.perform(); waitForIdle(); }