List of usage examples for org.openqa.selenium WebElement sendKeys
void sendKeys(CharSequence... keysToSend);
From source file:com.moodle.testmanager.pageObjectModel.UsersAddNewUser.java
License:GNU General Public License
/** * Enter a value in the email field where the value is specified in the test. * @param email The desired email address, this value is passed from the test. *//*from w ww . j a v a 2 s .c om*/ public void enterEmail(String email) { WebElement emailField = driver.findElement(By.cssSelector("#id_email")); emailField.sendKeys(email); }
From source file:com.moodle.testmanager.pageObjectModel.UsersAddNewUser.java
License:GNU General Public License
/** * Enter a value in the town/city field where the value is specified in the test. * @param city The desired town/city, this value is passed from the test. *///from ww w . j a v a 2s .c o m public void enterCity(String city) { WebElement cityTownCountry = driver.findElement(By.cssSelector("#id_city")); cityTownCountry.sendKeys(city); }
From source file:com.moodle.testmanager.pageObjectModel.WikiAddForm.java
License:GNU General Public License
/** * Generic text entry field for this class. * @param fieldLocator The locator value for field. Allways ID in this form. * @param valueToEnter The value that you would like to enter in the text field. *///from w w w . java2 s. co m private void textFieldWiki(String fieldLocator, CharSequence valueToEnter) { WebElement textField = driver.findElementById("id_firstpagetitle"); textField.sendKeys(valueToEnter); }
From source file:com.moodle.testmanager.pageObjectModel.WorkshopAddForm.java
License:GNU General Public License
/** * This form contains multiple rich text editors so it is necessary to locate anything other than the first on the page specifically. * The Module description is located by the "iframe" tagname as this is the fastest location strategy. This will still work as WebDriver will just find the * First element on the page. XPath is programmable so that has been used to locate the other TinyMCE elements. In this method the * Xpath is formed by using the ID of the table containing the form element and concatenating a prefix containing the XPath either side of that. * @param message The character sequence that you would like to enter. * @param tableID The ID of the table contining the iframe form element that locates the editor that you want to use. *///from w w w . java 2 s. co m private void richTextFieldWorkshop(CharSequence message, String tableID) { WebElement messagebox = driver.findElement(By.xpath(locGenXpathPrefix + tableID + locGenXpathSuffix)); driver.switchTo().frame(messagebox); WebElement richTextBox = driver.findElement(By.id("tinymce")); richTextBox.click(); richTextBox.sendKeys(message); driver.switchTo().window(driver.getWindowHandle()); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsViewPage.java
License:Open Source License
public void setSearchValue(String symbol) { WebElement searchBoxInput = driver.findElement(By.className("ui-inputtext")); searchBoxInput.sendKeys(symbol); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); }
From source file:com.mroza.seleniumTests.KidsViewTests.KidsViewPage.java
License:Open Source License
public void setSearchValue(String expectedSearchedSymbol) { WebElement searchboxArea = driver.findElement(By.className("ui-datatable-header")); WebElement searchBoxInput = searchboxArea.findElement(By.tagName("input")); searchBoxInput.sendKeys(expectedSearchedSymbol); SeleniumWaiter.waitForJQueryAndPrimeFaces(driver); }
From source file:com.mroza.seleniumTests.NewKidsViewTests.NewKidsViewPage.java
License:Open Source License
public void setKidCode(String code) { WebElement table = driver.findElement(By.tagName("table")); List<WebElement> columns = table.findElements(By.tagName("tr")).get(0).findElements(By.tagName("td")); WebElement searchBoxInput = columns.get(1).findElement(By.tagName("input")); searchBoxInput.sendKeys(code); }
From source file:com.mroza.seleniumTests.NewProgramsViewTests.NewProgramsViewPage.java
License:Open Source License
public void setAddProgramFields(String symbol, String name, String description) { WebElement symbolInputField = getInputFieldNamed(Utils.getMsgFromResources("newProgramsView.symbol")); symbolInputField.clear();/*from ww w . ja va2 s . c om*/ symbolInputField.sendKeys(symbol); WebElement nameInputField = getInputFieldNamed(Utils.getMsgFromResources("newProgramsView.name")); nameInputField.clear(); nameInputField.sendKeys(name); WebElement descriptionInputField = getTextAreaNamed( Utils.getMsgFromResources("newProgramsView.description")); descriptionInputField.clear(); descriptionInputField.sendKeys(description); }
From source file:com.mvnsnm.Register.java
public void register() { WebElement register = driver.findElement(By.xpath("//a[@id='new_register']")); final String text_a = "Register"; Assert.assertEquals(register.getText(), text_a); register.click();/* w w w . j a v a2s.c o m*/ WebElement first = driver.findElement(By.xpath("//input[@id='first']")); first.sendKeys(properties.get("first")); WebElement last = driver.findElement(By.xpath("//input[@id='last']")); last.sendKeys(properties.get("last")); WebElement email = driver.findElement(By.xpath("//input[@id='email']")); email.sendKeys(properties.get("email")); WebElement phone = driver.findElement(By.xpath("//input[@id='phonenum']")); phone.sendKeys(properties.get("phonenum")); WebElement address = driver.findElement(By.xpath("//input[@id='address']")); address.sendKeys(properties.get("address")); WebElement city = driver.findElement(By.xpath("//input[@id='city']")); city.sendKeys(properties.get("city")); WebElement state = driver.findElement(By.xpath("//input[@id='state']")); state.sendKeys(properties.get("state")); WebElement country = driver.findElement(By.xpath("//input[@id='country']")); country.sendKeys(properties.get("country")); WebElement zipcode = driver.findElement(By.xpath("//input[@id='zipcode']")); zipcode.sendKeys(properties.get("zipcode")); WebElement newuser = driver.findElement(By.xpath("//input[@id='username']")); newuser.sendKeys(properties.get("username")); WebElement passd = driver.findElement(By.xpath("//input[@id='password']")); passd.sendKeys(properties.get("password")); WebElement create = driver.findElement(By.xpath("//input[@id='savedata']")); create.click(); driver.get("http://localhost:8801"); }
From source file:com.mvnsnm.Tabviews.java
public void campaign() { WebElement tabhome = driver.findElement(By.xpath("//a[@id='ui-id-1']")); final String text_a = "Home"; Assert.assertEquals(text_a, tabhome.getText()); driver.findElement(By.id("ui-id-2")).click(); driver.findElement(By.xpath("//input[@id='campname']")).sendKeys("Hello Test"); WebElement select = driver.findElement(By.xpath("//select[@id='lstkeyword']")); List<WebElement> allOptions = select.findElements(By.tagName("option")); for (WebElement option : allOptions) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); String optval = option.getAttribute("value"); if (optval.equals("103")) { option.click();/*from w ww . j a v a 2 s .co m*/ } } //smsmessage smssendtime smssubmit WebElement msg = driver.findElement(By.xpath("//textarea[@id='smsmessage']")); msg.sendKeys("This message bodey was set from selenium automation and should save in db"); WebElement sendtime = driver.findElement(By.xpath("//input[@id='smssendtime']")); sendtime.sendKeys("2015/02/04 10:30:00"); WebElement submit = driver.findElement(By.xpath("//input[@id='smssubmit']")); submit.click(); WebElement chweekly = driver.findElement(By.xpath("//input[@id='weekly']")); chweekly.click(); WebElement monthslct = driver.findElement(By.xpath("//select[@id='weekofmonth']")); List<WebElement> weekopt = monthslct.findElements(By.tagName("option")); for (WebElement option : weekopt) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); String optval = option.getAttribute("value"); if (optval.equals("3")) { option.click(); } } //createmoremsg WebElement weekmsg = driver.findElement(By.xpath("//textarea[@id='createmoremsg']")); weekmsg.sendKeys("This message bodey was set for weekly report and can be saved in db"); //moremsgsave WebElement more_msg = driver.findElement(By.xpath("//input[@id='moremsgsave']")); more_msg.click(); chweekly.click(); WebElement monthly = driver.findElement(By.xpath("//input[@id='monthly']")); monthly.click(); WebElement monthofyear = driver.findElement(By.xpath("//select[@id='monthofyear']")); List<WebElement> monthopt = monthofyear.findElements(By.tagName("option")); for (WebElement option : monthopt) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); String optval = option.getAttribute("value"); if (optval.equals("7")) { option.click(); } } //createmoremsg WebElement monthlymsg = driver.findElement(By.xpath("//textarea[@id='monthlymsgmore']")); monthlymsg.sendKeys("This message bodey was set for weekly report and can be saved in db"); //moremsgsave WebElement monthlymsgsave = driver.findElement(By.xpath("//input[@id='monthlymsgsave']")); monthlymsgsave.click(); monthly.click(); }