@BeforeEach public void setup(@TempDirectory.TempDir Path folder) throws IOException { Assumptions.assumeTrue(Boolean.getBoolean("smoke.test"), "Smoke tests disabled (set System property 'smoke.test')"); this.downloadDir = folder.toFile(); FirefoxProfile fxProfile = new FirefoxProfile(); fxProfile.setPreference("browser.download.folderList", 2); fxProfile.setPreference("browser.download.manager.showWhenStarting", false); fxProfile.setPreference("browser.download.dir", this.downloadDir.getAbsolutePath()); fxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/zip,application/x-compress,application/octet-stream"); FirefoxOptions options = new FirefoxOptions().setProfile(fxProfile); this.driver = new FirefoxDriver(options); ((JavascriptExecutor) this.driver).executeScript("window.focus();"); Actions actions = new Actions(this.driver); this.enterAction = actions.sendKeys(Keys.ENTER).build(); }
Actions actions = new Actions(driver); actions.moveToElement(website); actions.click(); actions.sendKeys("Some Name"); actions.build().perform();
/** * Scrolls element to first cell in spreadsheet, clicks on it and sends the value as keystrokes. */ void scrollElementToFirstCellAndSendKeys(WebElement spreadsheetElement, String value) { new Actions(browser.driver).moveToElement(spreadsheetElement) .click().sendKeys(value).build().perform(); }
/** * Types the keys. */ @Override public void go() { logger.info("Typing \"{}\"...", (Object) keys); new Actions(getWebDriver()).sendKeys(Keys.ENTER); }
/** * Sending keys to where the current focus is. * @param text keys to send */ public static void sendKeys(String text) { getActions().sendKeys(text).perform(); }
/** * Sending keys to where the current focus is. * @param keys keys to send */ public static void sendKeys(Keys... keys) { getActions().sendKeys(keys).perform(); }
Actions actions = new Actions(driver); actions.moveToElement(element); actions.click(); actions.sendKeys("Some Name"); actions.build().perform();
public void pressCtrlF12() { actionsFactory .createAction(seleniumWebDriver) .keyDown(CONTROL) .sendKeys(F12) .keyUp(CONTROL) .perform(); }
public SelenideElement pressEscape() { invoker.doJAction("Press Escape on Element", () -> { Actions builder = new Actions(getDriver()); builder.sendKeys(getWebElement(), Keys.ESCAPE).perform(); }); return this; }
public J pressEnter() { invoker.doJAction("Press Enter on Element", () -> { Actions builder = new Actions(getDriver()); builder.sendKeys(getWebElement(), Keys.ENTER).perform(); }); return this; }
public JList append(String text) { invoker.doJAction("Append text to Element", () -> { Actions builder = new Actions(getDriver()); builder.sendKeys(getWebElement(), text).perform(); }); return this; } public SelenideElement scrollIntoView(boolean b) {
public JList pressTab() { invoker.doJAction("Press Tab on Element", () -> { Actions builder = new Actions(getDriver()); builder.sendKeys(getWebElement(), Keys.TAB).perform(); }); return this; }
/** * Send keys through composite actions * /!\ does not clear text before and no blur after * * @param keysToSend */ @ReplayOnError public void sendKeysAction(CharSequence... keysToSend) { findElement(true); new Actions(driver).sendKeys(element, keysToSend).build().perform(); }
public J append(String text) { invoker.doJAction("Append text to Element", () -> { Actions builder = new Actions(getDriver()); builder.sendKeys(getWebElement(), text).perform(); }); return this; }
public J pressEnter() { invoker.doJAction("Press Enter on Element", () -> { Actions builder = new Actions(getDriver()); builder.sendKeys(getWebElement(), Keys.ENTER).perform(); }); return this; }
/** * Simulate Enter key */ @Override @PublicAtsApi public void pressEnterKey() { new HiddenHtmlElementState(this).waitToBecomeExisting(); WebElement element = HiddenHtmlElementLocator.findElement(this); new Actions(htmlUnitDriver).sendKeys(element, "\r").perform(); // new Actions( htmlUnitDriver ).sendKeys( element, Keys.RETURN ).perform(); }
private KeyboardShortcutsModal triggerEscapeShortcut() { actions.sendKeys(Keys.ESCAPE).perform(); wait.forElementNotVisible(keyboardShortcutsModalSelector); Log.info("Keyboard shortcuts modal was closed by ESC keyboard button"); return this; }
private ActionExplorerModal triggerDotShortcut() { actions.sendKeys(".").perform(); wait.forElementVisible(actionExplorerModalSelector); Log.info("Action Explorer modal was opened by . button"); return this; }
public ActionExplorerModal searchFor(String searchQuery) { wait.forElementClickable(searchField); actions.sendKeys(searchQuery).perform(); Log.info("Typed in search box: " + searchQuery); return this; }
public void deleteTransclusion(int index, Transclusion transclusion) { clickTransclusion(index, transclusion); Actions actions2 = new Actions(driver); actions2.sendKeys(Keys.DELETE).build().perform(); }