List of usage examples for org.openqa.selenium WebElement submit
void submit();
From source file:org.eclipse.epsilon.emc.web.WebDriver.java
License:Open Source License
private void authenticate() { try {//from ww w . java2 s . c o m WebElement username = driver.findElement(By.name("username")); username.sendKeys("lmr109"); driver.findElement(By.name("password")).sendKeys("r2o6s8i4e"); username.submit(); } catch (NoSuchElementException e) { // Username field wasn't found // So no authentication necessary } }
From source file:org.eclipse.packagedrone.testing.server.channel.ChannelTester.java
License:Open Source License
public static ChannelTester create(final WebContext context, final String... names) { // get before list of channels final Set<String> before = getAllChannelIds(context); // create channel context.getDriver().get(context.resolve("/channel/createWithRecipe")); final WebElement element = context.findElement(By.id("names")); for (final String name : names) { element.sendKeys(name, "\n"); }// w ww . ja va 2s . c om element.submit(); // get after list of channels final Set<String> after = getAllChannelIds(context); after.removeAll(before); if (after.isEmpty()) { throw new RuntimeException("Channel did not get created"); } if (after.size() > 1) { throw new RuntimeException("More than one channel was created when adding channel"); } // return new channel return new ChannelTester(context, after.iterator().next()); }
From source file:org.eclipse.packagedrone.testing.server.channel.ChannelTester.java
License:Open Source License
public void assignDeployGroup(final String deployGroupName) { get(String.format("/channel/%s/deployKeys", this.id)); final WebElement ele = this.context.findElement(By.id("groupId")); new Select(ele).selectByVisibleText(deployGroupName); ele.submit(); }
From source file:org.eclipse.packagedrone.testing.server.channel.DebTest.java
License:Open Source License
@Test public void testDeb2() throws Exception { final ChannelTester ct = ChannelTester.create(getWebContext(), "deb2"); ct.addAspect("deb"); ct.addAspect("apt"); {/*ww w . jav a 2 s .c o m*/ final Set<String> result = ct.upload(DEB_RESOURCE); Assert.assertEquals(1, result.size()); } Assert.assertEquals(1, ct.getAllArtifactIds().size()); testUrl(String.format("/apt/%s", ct.getId())); // index page getWebContext().getResolved(String.format("/config/deb/channel/%s/edit", ct.getId())); final WebElement desc = getWebContext().findElement(By.name("description")); desc.sendKeys("Test Description"); desc.submit(); testUrl(String.format("/apt/%s", ct.getId()), Pattern.compile(".*APT Repository \\|.*", Pattern.DOTALL)); // index page testUrl(String.format("/apt/%s/dists/default/Release", ct.getId())); testUrl(String.format("/apt/%s/dists/default/main/binary-amd64/Release", ct.getId())); testUrl(String.format("/apt/%s/dists/default/main/binary-amd64/Packages", ct.getId())); testUrl(String.format("/apt/%s/dists/default/main/binary-i386/Release", ct.getId())); testUrl(String.format("/apt/%s/dists/default/main/binary-i386/Packages", ct.getId())); }
From source file:org.eclipse.packagedrone.testing.server.channel.UploadTest.java
License:Open Source License
private void withChannel(final String channelId) { driver.get(resolve(String.format("/channel/%s/viewPlain", channelId))); // should be an empty channel Assert.assertTrue(findArtifacts().isEmpty()); driver.get(resolve(String.format("/channel/%s/add", channelId))); // test for "Upload" active final WebElement link = driver.findElement(By.linkText("Upload")); Assert.assertTrue(link.findElement(By.xpath("..")).getAttribute("class").contains("active")); // upload file final File input = getAbsolutePath(CommonResources.BUNDLE_1_RESOURCE); {//from w ww.ja va2 s. com final WebElement ele = driver.findElementById("file"); Assert.assertNotNull(ele); ele.sendKeys(input.toString()); ele.submit(); } // navigate to plain view driver.get(resolve(String.format("/channel/%s/viewPlain", channelId))); // check upload final List<String> arts = findArtifacts(); Assert.assertEquals(1, arts.size()); }
From source file:org.jboss.arquillian.android.example.AndroidTestCase.java
License:Apache License
@Test public void testGoogle(@Drone AndroidDriver driver) throws Exception { // 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")); Files.copy(driver.getScreenshotAs(OutputType.FILE), new File("target/screen.png")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); Files.copy(driver.getScreenshotAs(OutputType.FILE), new File("target/screen2.png")); }
From source file:org.jspringbot.keyword.selenium.SeleniumHelper.java
License:Open Source License
public void submitForm(String locator) { LOG.info("Submitting form '%s'.", locator); WebElement el = finder.find(locator, "form"); el.submit(); }
From source file:org.jvmi.automator.dpcs.DPCSClient.java
private DPCSItem fetch(String id) { driver.get(/*from w ww . j a va 2 s . c o m*/ "https://donor.dpconsulting.com/NewDDI/MainPage.asp?Head=InvSrch.asp%3FPage%3DHead&Main=InvSrch.asp%3FPage%3DMain"); driver.switchTo().frame("Main"); WebElement itemCodeField = driver.findElement(By.cssSelector("input[name='Code']")); itemCodeField.sendKeys(id); itemCodeField.submit(); String fmv = driver.findElement(By.cssSelector("input[name='Price']")).getAttribute("value"); String retail = driver.findElement(By.cssSelector("input[name='Retail']")).getAttribute("value"); String offer = driver.findElement(By.cssSelector("input[name='FMV']")).getAttribute("value"); final DPCSItem item = new DPCSItem(); item.setFairMarketValue(parseDouble(fmv)); item.setRetailPrice(parseDouble(retail)); item.setOfferPrice(parseDouble(offer)); return item; }
From source file:org.lunifera.example.vaadin.osgi.testpart.TextFieldPartTest.java
License:Apache License
@Test public void test() { WebDriver driver = new FirefoxDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Alternatively the same thing can be done like this // driver.navigate().to("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/*from www .j av a 2 s. c o m*/ element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); // Should see: "cheese! - Google Search" System.out.println("Page title is: " + driver.getTitle()); // Close the browser driver.quit(); }
From source file:org.mifos.server.workspace.SeleniumTest.java
License:Open Source License
@Test public void testSearchMifosOnGoogle() throws Exception { WebDriver wd = new FirefoxDriver(); try {//from w w w . ja va 2 s.c o m wd.get("http://www.google.com"); WebElement element = wd.findElement(By.name("q")); element.sendKeys("Mifos"); element.submit(); } finally { wd.quit(); } }