Example usage for org.openqa.selenium Keys ENTER

List of usage examples for org.openqa.selenium Keys ENTER

Introduction

In this page you can find the example usage for org.openqa.selenium Keys ENTER.

Prototype

Keys ENTER

To view the source code for org.openqa.selenium Keys ENTER.

Click Source Link

Usage

From source file:io.openvidu.test.e2e.OpenViduTestAppE2eTest.java

License:Apache License

private void gracefullyLeaveParticipants(int numberOfParticipants) throws Exception {
    int accumulatedConnectionDestroyed = 0;
    for (int j = 1; j <= numberOfParticipants; j++) {
        user.getDriver().findElement(By.id("remove-user-btn")).sendKeys(Keys.ENTER);
        user.getEventManager().waitUntilEventReaches("sessionDisconnected", j);
        accumulatedConnectionDestroyed = (j != numberOfParticipants)
                ? (accumulatedConnectionDestroyed + numberOfParticipants - j)
                : (accumulatedConnectionDestroyed);
        user.getEventManager().waitUntilEventReaches("connectionDestroyed", accumulatedConnectionDestroyed);
    }/*from ww w  .  j  av a2 s  . co  m*/
}

From source file:io.spring.initializr.web.project.ProjectGenerationSmokeTests.java

License:Apache License

@Before
public void setup() throws IOException {
    Assume.assumeTrue("Smoke tests disabled (set System property 'smoke.test')",
            Boolean.getBoolean("smoke.test"));
    downloadDir = folder.newFolder();/*from w ww. jav a2s  . c o m*/
    FirefoxProfile fxProfile = new FirefoxProfile();
    fxProfile.setPreference("browser.download.folderList", 2);
    fxProfile.setPreference("browser.download.manager.showWhenStarting", false);
    fxProfile.setPreference("browser.download.dir", downloadDir.getAbsolutePath());
    fxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
            "application/zip,application/x-compress,application/octet-stream");
    FirefoxOptions options = new FirefoxOptions().setProfile(fxProfile);
    driver = new FirefoxDriver(options);
    ((JavascriptExecutor) driver).executeScript("window.focus();");

    Actions actions = new Actions(driver);
    enterAction = actions.sendKeys(Keys.ENTER).build();
}

From source file:it.measure.ProjectDashboardTest.java

License:Open Source License

@Test
public void display_tags_with_edit() {
    executeBuild("shared/xoo-sample", "sample-with-tags", "Sample with tags");
    // Add some tags to another project to have them in the list
    wsClient.wsConnector().call(new PostRequest("api/project_tags/set").setParam("project", "sample-with-tags")
            .setParam("tags", "foo,bar,baz"));

    executeBuild("shared/xoo-sample", "sample", "Sample");
    ProjectDashboardPage page = nav.logIn().asAdmin().openProjectDashboard("sample");
    page.shouldHaveTags("No tags").shouldBeEditable().openTagEditor().getTagAtIdx(2).click();
    page.shouldHaveTags("foo").sendKeysToTagsInput("test").getTagAtIdx(0).should(hasText("+ test")).click();
    page.shouldHaveTags("foo", "test").getTagAtIdx(1).should(hasText("test"));
    page.sendKeysToTagsInput(Keys.ENTER).shouldHaveTags("test");
}

From source file:jp.co.nssol.h5.test.selenium.base.H5TestCase.java

License:Apache License

protected static void click(WebElement elem) {
    if (driver instanceof InternetExplorerDriver) {
        elem.sendKeys(Keys.ENTER);
    } else {/* w  w  w .java  2 s . c om*/
        elem.click();
    }
}

From source file:Logic.GlassdoorScraper.java

public void fetchJobs(String url) {
    try {//from w w w  . j  ava 2 s  . co m
        setProperty("webdriver.chrome.driver", "C:\\Users\\jason\\Desktop\\Selenium Jars\\chromedriver.exe");
        //setProperty("webdriver.chrome.driver", "C:\\Users\\jleung\\Desktop\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get(url);

        //waits at least 10 seconds for each element before timesout.
        wait = new WebDriverWait(driver, 60);
        //query search
        WebElement querySearch = wait
                .until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@id='KeywordSearch']")));
        querySearch.sendKeys(query);
        //location search
        WebElement locationSearch = wait.until(
                ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@id='LocationSearch']")));
        locationSearch.clear();
        locationSearch.sendKeys(location);
        locationSearch.sendKeys(Keys.ENTER);
        //submit button
        WebElement submitBtn = wait
                .until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@type='submit']")));
        submitBtn.click();
        //calls upon helper method to grab links and place into list
        grabGlassDoorLinks();
        //iterates to the next tabs of glassdoor jobs to grab their urls as well.
        iterateGlassDoor();
    } catch (NoSuchElementException ex) {
        return;
    }
}

From source file:net.codestory.simplelenium.filters.LazyDomElement.java

License:Apache License

@Override
public LazyDomElement pressEnter() {
    return execute("pressEnter()", element -> element.sendKeys(Keys.ENTER));
}

From source file:OnlineStore.SearchTest.java

/**
* Given a not existed product name/*from w ww .  j  a va2 s.  c  om*/
* When I search the product
* Then I should see message informing me no result
*/
@Test
public void searchNotExistedProduct() {
    driver.get("http://store.demoqa.com/");
    WebElement searchBox = driver.findElement(By.className("search"));
    searchBox.clear();
    searchBox.sendKeys("Samsung");
    searchBox.sendKeys(Keys.ENTER);
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
    String ans = "Sorry, but nothing matched your search criteria. Please try again with some different keywords.";
    assertEquals(ans, driver.findElement(By.xpath("//*[@id=\"content\"]/p")).getText());
}

From source file:OnlineStore.SearchTest.java

/**
* Given an existed product name// www.j a v  a2s. co m
* When I search the product
* Then I should see a list of products
*/
@Test
public void searchExistedProduct() {
    driver.get("http://store.demoqa.com/");
    WebElement searchBox = driver.findElement(By.className("search"));
    searchBox.clear();
    searchBox.sendKeys("iphone");
    searchBox.sendKeys(Keys.ENTER);
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
    WebElement productList = driver.findElement(By.xpath("//*[@id='grid_view_products_page_container']/div"));
    List<WebElement> images = productList.findElements(By.className("item_image"));
    assertTrue(images.size() == 5);
}

From source file:org.ado.picasa.Main.java

License:Apache License

private static void loginIntoPicasa(String pin, FirefoxDriver driver) throws InterruptedException {
    driver.get("https://picasaweb.google.com");
    driver.findElement(new By.ByName("Email")).sendKeys(System.getenv("GOOGLE_ACCOUNT"), Keys.ENTER);
    TimeUnit.SECONDS.sleep(1);/*w ww  .  ja  v a  2s.co m*/

    driver.findElement(new By.ByName("Passwd")).sendKeys(System.getenv("GOOGLE_PASSWORD"), Keys.ENTER);
    TimeUnit.SECONDS.sleep(1);

    if (StringUtils.isNotBlank(pin)) {
        driver.findElement(new By.ByName("Pin")).sendKeys(pin, Keys.ENTER);
        TimeUnit.SECONDS.sleep(1);
    }
}

From source file:org.alfresco.po.share.InviteToAlfrescoPage.java

License:Open Source License

/**
 * Enter email addresses/*from ww w. j  av  a 2 s.  c  o m*/
 * 
 * @param userEmails String[]
 */
public void inputEmailsForInvitation(String[] userEmails) {
    if (userEmails == null) {
        throw new UnsupportedOperationException("userEmail(s) for invitation cannot be null");
    }
    WebElement textArea = findAndWait(EMAILS_TEXTAREA);
    textArea.clear();
    for (String userEmail : userEmails) {
        if (userEmail.equals("")) {
            throw new UnsupportedOperationException("userEmail can be empty");
        }
        textArea.sendKeys(userEmail);
        textArea.sendKeys(Keys.ENTER);
    }
}