List of usage examples for org.openqa.selenium WebElement submit
void submit();
From source file:com.google.iphone.testing.nativedriver.client.NativeDriverTest.java
License:Apache License
public void testNativeDriver() throws Exception { WebDriver driver = new IosNativeDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // Type user name WebElement userName = driver.findElement(By.placeholder("User Name")); userName.clear();//from ww w. ja v a 2 s . co m userName.sendKeys("NativeDriver"); // Type password WebElement password = driver.findElement(By.placeholder("Password")); password.clear(); password.sendKeys("abcdefgh"); // Tap "Sign in" button driver.findElement(By.text("Sign in")).click(); // Verify correct title is displayed String text = driver.getTitle(); assertEquals("NativeDriver", text); // Type text in WebView WebElement element = driver.findElement(By.name("q")); element.sendKeys("NativeDriver"); element.submit(); // Click link driver.findElement(By.partialLinkText("GUI automation")).click(); // Verify the page assertEquals("nativedriver", driver.findElement(By.id("pname")).getText()); }
From source file:com.ibm.watson.movieapp.dialog.fvt.webui.MovieUI.java
License:Open Source License
/** * askQuestion/* ww w . j ava 2 s . co m*/ * @param question */ public void ask(BaseQuestion question) { BaseResponse resp = new BaseResponse.Builder().build(); //wait for chatbox to be enabled fluentWaitNotPresent(chatBoxDisabled); //collect conversation List<WebElement> preQuestCount = findElements(conversationsWeb); logger.info("INFO: Number of total questions asked in this conversations " + preQuestCount.size()); //ensure the chatbox exists fluentWaitVisible(chatBox); WebElement chatbox = findElement(chatBox); chatbox.click(); logger.info("INFO: Sending \"" + question.getText() + "\" to " + chatBox); chatbox.sendKeys(question.getText()); chatbox.submit(); //wait for thinking animation has completed fluentWaitNotPresent(watsonThinkAnimation); //collect questions and wait for new question to be added List<WebElement> postQuestCount = findElements(conversationsWeb); while (preQuestCount.size() >= postQuestCount.size()) { postQuestCount = findElements(conversationsWeb); } //General check to ensure that we are not waiting on any animations fluentWaitNotPresent(animationActive); logger.info("INFO: Number of total questions asked in this conversations " + postQuestCount.size()); //collect last question answer WebElement thisQuestion = postQuestCount.get(postQuestCount.size() - 1); List<WebElement> questPart = thisQuestion.findElements(By.cssSelector(questionParts)); //set response to the answer resp.setResponseText(questPart.get(1).getText()); //add response to question logger.info("INFO: Adding Response text to Question object"); question.setResponse(resp); //add any movies that are part of the response to question List<WebElement> movies = findElements(movieResponse); if (movies.size() > 0) { question.setMovies(movies); } }
From source file:com.ibm.watson.movieapp.dialog.fvt.webui.MovieUI.java
License:Open Source License
/** * selectNextButton - //from w w w. j ava2s . co m */ public void selectNextButton() { fluentWaitVisible(nextButtonLoc); WebElement nextButton = findElement(nextButtonLoc); nextButton.submit(); }
From source file:com.moodle.testmanager.FormActions.java
License:GNU General Public License
/** * Picks a given item from the resource picker on the course page to add a resource or activity. * @param outlineSection The Section that you would like to add the activity/resource in. * @param radioID The id of the radio button to select to add an activity or resource. */// w w w . j ava 2s . c o m public void addItemResourcePicker(String outlineSection, String radioID) { driver.findElement( By.xpath("//*[@id='section-" + outlineSection + "']/*/*/*/div[@class='section-modchooser']/*/*")) .click(); WebElement radio = driver.findElement(By.id(radioID)); radio.click(); radio.submit(); }
From source file:com.mto.arquillian.demo.ChromeWebDriverTest.java
License:Open Source License
@Test @RunAsClient//from w w w . ja v a 2 s.co m @InSequence(1) public void testRegister(@ArquillianResource URL url) throws Exception { driver.navigate().to(url.toString() + "register/"); WebElement form = driver.findElement(By.tagName("form")); form.findElement(By.name("username")).sendKeys("gatein"); form.submit(); assertEquals( "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body><pre>You have registered succesfully under the name: gatein</pre></body></html>", driver.getPageSource()); }
From source file:com.mycompany.firstmavenproject.command.SubmitCommand.java
@Override public void execute(Object driverObject) { WebElement we = (WebElement) driverObject; we.submit(); }
From source file:com.mycompany.myselion.sample.selion.AppiumAndroidDemoTest.java
License:Apache License
/** * This test demonstrates how to use SeLion for running tests against ANDROID browser using appium. * <ul>/*from w w w .ja v a 2s. c o m*/ * <li> * An appium instance/server should be installed and running where selenium host and port should be * pointed to this instance.</li> * <li> * For setting up Appium Android refer http://appium.io/slate/en/master/?ruby#system-setup-(android) * </li> * </ul> */ @Test @MobileTest(appName = "Browser", device = "android:5.0.1", deviceType = "Android Emulator") public void testWithBrowser() { RemoteWebDriver driver = Grid.driver(); assertNotNull(driver); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); SeLionReporter.log("cheese!", true); }
From source file:com.mycompany.myselion.sample.selion.AppiumIOSDemoTest.java
License:Apache License
/** * This test demonstrates how to use SeLion for running tests against IOS safari using appium. * <ul>/*from w ww. jav a2s . c o m*/ * <li> * An appium instance/server should be installed and running where selenium host and port should be * configured to the same appium instance.</li> * <li> * For setting up Appium iOS refer http://appium.io/slate/en/master/?ruby#system-setup-(ios) * </li> * </ul> */ @Test @MobileTest(appName = "safari", device = "iphone:8.1", deviceType = "iPhone Simulator") public void testWithSafari() { //To gain access to the IOSRemoteWebDriver, we use the thread safe helper method Grid.driver() which provides //an instance of IOSRemoteWebDriver for the current Test method. RemoteWebDriver driver = Grid.driver(); assertNotNull(driver); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); // take a screenshot SeLionReporter.log("cheese!", true); }
From source file:com.mycompany.myselion.sample.selion.SelendroidDemoTest.java
License:Apache License
/** * This test demonstrates how to use SeLion for running tests against ANDROID browser using selendroid. *//* w w w . jav a2 s.c om*/ @Test @MobileTest(appName = "android", device = "android:19") public void testLaunch() throws Exception { RemoteWebDriver driver = Grid.driver(); assertNotNull(driver); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); SeLionReporter.log("cheese!", true, true); }
From source file:com.mycompany.newseleniumtest.TestScript.java
public boolean workbenchLogin(String user) { boolean output = true; try {//from www . java 2 s .c o m this.startDriver("firefox"); this.driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); WebDriverWait wait = new WebDriverWait(driver, 10); //Open the page this.driver.get("http://" + this.testLocation + ".uangteman.com/admin"); // this.driver.get("localhost:80/uang-teman/admin"); WebElement main; switch (user) { case ("finance"): this.driver.findElement(By.name("bu_name")).sendKeys("ddebora_fi"); break; case ("admin"): this.driver.findElement(By.name("bu_name")).sendKeys("pras_admin"); break; case ("staff"): this.driver.findElement(By.name("bu_name")).sendKeys("rahmat_staff"); break; case ("fraudcheck"): this.driver.findElement(By.name("bu_name")).sendKeys("pras_fc"); break; case ("customerservice"): this.driver.findElement(By.name("bu_name")).sendKeys("rahmat_cs"); break; case ("pras_supermanager"): this.driver.findElement(By.name("bu_name")).sendKeys("pras_supermanager"); break; case ("supermanager_redho"): this.driver.findElement(By.name("bu_name")).sendKeys("redho"); break; case ("fauzan"): this.driver.findElement(By.name("bu_name")).sendKeys("fauzan"); break; case ("pras_manager"): this.driver.findElement(By.name("bu_name")).sendKeys("pras_manager"); break; case ("ddebora_mgr"): this.driver.findElement(By.name("bu_name")).sendKeys("ddebora_mgr"); break; case ("fahmy_manager"): this.driver.findElement(By.name("bu_name")).sendKeys("fahmy_manager"); break; case ("eka"): this.driver.findElement(By.name("bu_name")).sendKeys("eka"); break; case ("collection"): this.driver.findElement(By.name("bu_name")).sendKeys("kevincol"); break; default: throw new Exception("No user"); } this.driver.findElement(By.name("bu_passwd")).sendKeys("testing"); main = this.driver.findElement( By.cssSelector("button[class='btn btn-orange btn-squared pull-right ladda-button']")); main.submit(); //SMS verifications if (!this.testLocation.equals("dev")) { Thread.sleep(5000); String sms_code = (String) SupportController.getfromDatabase( "SELECT bua_auth_code FROM bo_auth_log ORDER BY bua_id DESC LIMIT 1;", this.testLocation); this.driver.findElement(By.name("authcode")).sendKeys(sms_code); this.driver .findElement(By .cssSelector("button[class='btn btn-bricky btn-squared pull-right ladda-button']")) .click(); } } catch (Exception e) { System.out.println("TestScript Login-Error: " + e.getMessage()); output = false; } finally { return output; } }