WebElement selectDistributor = driver.findElement(By.xpath("//html/body/div[3]/div[2]/div/div/form/div[3]/div/div/div/div/div[5]/div/div/div/select/option")).sendKeys(dis); //this is an example without seeing the HTML code Assert.assertEquals("Expecting my distributor to be John", selectDistributor.getValue("john");
public String getValue() { return element.getValue(); }
public String getValue() { return element.getValue(); }
protected boolean shouldAdd(WebElement element, String filterValue) { String value = element.getValue(); return filterValue.equals(value); } }
public String apply(@Nullable final WebElement from) { return from.getValue(); } };
@Override public boolean matchesSafely(WebElement item) { return item.getValue().equals(value); }
@Override public boolean matchesSafely(WebElement item) { return item.getValue().equals(value); }
protected boolean selectOption(WebElement option, String selectThis) { return selectThis.equals(option.getValue()); } }
String[] act = new String[allOptions.length]; int i = 0; for (WebElement option : allOptions) { act[i++] = option.getValue(); } List<String> expected = Arrays.asList(exp); List<String> actual = Arrays.asList(act); Assert.assertNotNull(expected); Assert.assertNotNull(actual); Assert.assertTrue(expected.containsAll(actual)); Assert.assertTrue(expected.size() == actual.size());
/** * Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter). * For checkbox/radio elements, the value will be "on" or "off" depending on * whether the element is checked or not. * * @param locator an <a href="#locators">element locator</a> * @return the element value, or "on/off" for checkbox/radio elements */ public String getValue(String locator) { return findElement(locator).getValue(); }
public String value() { return waitForWebElement().getValue(); }
private String[] findSelectedOptionProperties(String selectLocator, String property) { List<WebElement> options = getOptions(selectLocator); List<String> selectedOptions = new ArrayList<String>(); for (WebElement option : options) { if (option.isSelected()) { if ("text".equals(property)) { selectedOptions.add(option.getText()); } else if ("value".equals(property)) { selectedOptions.add(option.getValue()); } else { String propVal = option.getAttribute(property); if (propVal != null) selectedOptions.add(propVal); } } } if (selectedOptions.size() == 0) throw new SeleniumException("No option selected"); return selectedOptions.toArray(new String[selectedOptions.size()]); }
public ResultType call() throws Exception { response = newResponse(); response.setValue(getElement().getValue()); return ResultType.SUCCESS; }
public ResultType call() throws Exception { response = newResponse(); response.setValue(getElement().getValue()); return ResultType.SUCCESS; }