List of usage examples for org.openqa.selenium By className
public static By className(String className)
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * Move Field./*from ww w . j av a 2 s .c om*/ * @param start {@link String} * @param end {@link String} */ private void moveField(final String start, final String end) { WebElement el = findElementBy(By.className("form-section")); JavascriptExecutor executor = (JavascriptExecutor) getDriver(); executor.executeScript("postJSON('/api/flow?execution=' + getExecution() + " + "'&_eventId_fieldmove=" + el.getAttribute("data-uuid") + "," + start + el.getAttribute("data-uuid") + "," + end + "', null);"); getDriver().navigate().refresh(); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow11().//ww w . j av a 2 s . co m * add Signature and then edit.. * * @throws Exception Exception */ @Test public void testAddWorkflow11() throws Exception { // given FormJSONFieldType typeSelect = FormJSONFieldType.SIGNATURE; ImmutableMap<String, String> values = ImmutableMap.of("20", "new field", "40", "Immediate[immediate]"); // when - add step clickAddNewWorkflow(); addBlankForm(); menuDragAndDrop("menu-signature"); // then WebElement element = findElementBy(By.className("signature-pad")); assertTrue(element.isDisplayed()); assertEquals("", element.getText()); checkEditField("1", typeSelect, values); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * testAddWorkflow19()./*from w ww . j ava2 s . c o m*/ * change section name. * * @throws Exception Exception */ @Test public void testAddWorkflow19() throws Exception { // given // when - add step clickAddNewWorkflow(); addBlankForm(); menuDragAndDrop("menu-textbox"); findElementBy(By.className("button-section-edit")).click(); getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); findElementBy(By.name("title")).sendKeys("samplesection"); //findElementBy(By.className("form-modal-update-button")).click(); click(By.name("_eventId_next")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("fieldeditorform"))); assertEquals("samplesection", findElementBy(By.className("button-section-edit")).getText().trim()); // when findElementBy(By.className("button-section-edit")).click(); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("fieldeditorform"))); assertEquals("samplesection", findElementBy(By.name("title")).getAttribute("value")); }
From source file:com.formkiq.web.WorkflowEditorControllerIntegrationTest.java
License:Apache License
/** * Cancel Editor Button./*from w ww . j a v a 2 s .com*/ * * @throws Exception Exception */ @Test public void testAddWorkflow30() throws Exception { // given // when clickAddNewWorkflow(); click(By.id("button-cancel")); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal"))); // when click(By.className("form-modal-close-button")); // then getWait().until(ExpectedConditions.invisibilityOfElementLocated(By.id("form-modal"))); // when click(By.id("button-cancel")); // then getWait().until(ExpectedConditions.visibilityOfElementLocated(By.id("form-modal"))); // when click(By.className("form-modal-cancel-button")); // then assertEquals(getDefaultHostAndPort() + "/user/dashboard/index", getCurrentUrl()); }
From source file:com.gargoylesoftware.htmlunit.libraries.YuiTest.java
License:Apache License
private void doTest(final String fileName, final List<String> knownFailingTests, final String buttonToPush, final long timeToWait) throws Exception { // final URL url = getClass().getClassLoader().getResource("tests/" + fileName); final String url = URL_FIRST + "tests/" + fileName; assertNotNull(url);/*from ww w . j a va 2 s .co m*/ final WebDriver driver = getWebDriver(); driver.get(url); if (buttonToPush != null) { driver.findElement(By.id(buttonToPush)).click(); } driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); final WebElement logDiv = driver.findElement(By.className("yui-log-bd")); final WebElement lastMessage = logDiv .findElement(By.xpath("pre[last() and contains(string(.), 'Testing completed')]")); LOG.info(lastMessage.getText()); driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); final List<WebElement> tests = driver.findElements(By.xpath("//p[span[@class='pass' or @class='fail']]")); if (tests.isEmpty()) { fail("No tests were executed!"); } for (final WebElement pre : tests) { final String[] parts; try { parts = pre.getText().split(" "); } catch (final StaleElementReferenceException e) { continue; // happens for FF17 on imageLoader test } final String result = parts[0]; final String testName = parts[1].substring(0, parts[1].length() - 1); if ("pass".equalsIgnoreCase(result)) { assertTrue("Test case '" + testName + "' is in the known failing list, but passes!", !knownFailingTests.contains(testName)); } else { assertTrue("Test case '" + testName + "' is not in the known failing list, but fails!", knownFailingTests.contains(testName)); } } }
From source file:com.gdf.managedBean.TendererInvitationBeanTest.java
@Test public void send() { email = driver.findElement(By.xpath("//input[contains(@id, 'mailForm:email')]")); sendButton = driver.findElement(By.xpath("//button[contains(@id, 'mailForm:send')]")); email.clear();// ww w.j a va 2s.c o m email.sendKeys("guendouzbachir@hotmail.com"); sendButton.click(); // Test WebElement growlTitle = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By.className("ui-growl-title"))); // Verification assertEquals(growlTitle.getText(), "Message envoy!"); }
From source file:com.gdf.managedBean.TendererRegistrationBeanTest.java
@Test public void registration() { // Preparation driver.get(baseUrl);//w w w . ja v a2 s.co m inputLogin = driver.findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerLogin')]")); inputPassword = driver .findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerPassword')]")); inputConfirmPassword = driver .findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerConfirmPassword')]")); inputMail = driver.findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerMail')]")); inputFirstname = driver .findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerFirstname')]")); inputLastName = driver .findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerLastname')]")); inputPhone = driver .findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerPhoneNumber')]")); inputAvatar = driver.findElement(By.xpath("//input[contains(@id,'registerTendererForm:registerAvatar')]")); registerButton = driver .findElement(By.xpath("//button[contains(@id,'registerTendererForm:tenderRegisterButton')]")); inputLogin.clear(); inputLogin.sendKeys("SuperTenderer" + new Random().nextInt(1000)); inputPassword.clear(); inputPassword.sendKeys("password1234"); inputConfirmPassword.clear(); inputConfirmPassword.sendKeys("password1234"); inputMail.clear(); inputMail.sendKeys("super.tenderer@mymail.com"); inputFirstname.clear(); inputFirstname.sendKeys("I'm the"); inputLastName.clear(); inputLastName.sendKeys("SuperTenderer"); inputPhone.clear(); inputPhone.sendKeys("2820092809"); inputAvatar.clear(); inputAvatar.sendKeys("http://www.batterytender.com/assets/img/logo_BTmainNav.png"); registerButton.click(); // Test WebElement growlTitle = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By.className("ui-growl-title"))); // Verification assertEquals(growlTitle.getText(), "Inscription russie !"); }
From source file:com.ggasoftware.jdiuitest.web.selenium.elements.pageobjects.annotations.WebAnnotationsUtil.java
License:Open Source License
public static By getFindByLocator(FindBy locator) { if (locator == null) return null; if (!"".equals(locator.id())) return By.id(locator.id()); if (!"".equals(locator.className())) return By.className(locator.className()); if (!"".equals(locator.xpath())) return By.xpath(locator.xpath()); if (!"".equals(locator.css())) return By.cssSelector(locator.css()); if (!"".equals(locator.linkText())) return By.linkText(locator.linkText()); if (!"".equals(locator.name())) return By.name(locator.name()); if (!"".equals(locator.partialLinkText())) return By.partialLinkText(locator.partialLinkText()); if (!"".equals(locator.tagName())) return By.tagName(locator.tagName()); return null;//from w ww.j av a 2 s . com }
From source file:com.gigaspaces.webuitf.datagrid.configuration.ConfigurationGrid.java
License:Open Source License
protected String getValue(WebElement webElement) { WebElement valueColumnElement = webElement.findElement(By.className("x-grid3-col-configValueCol")); WebElement spanElement = valueColumnElement.findElement(By.tagName("span")); return spanElement.getText(); }
From source file:com.github.wasiqb.coteafs.appium.android.vodqa.activities.PhotoViewActivity.java
License:Apache License
@Override protected DeviceElement prepare() { final DeviceElement main = super.prepare(); DeviceElement.create("Img").parent(main).forAndroid(By.className("android.widget.ImageView")); return main;/* ww w . ja va 2 s. c o m*/ }