@When("^틴캐시 결제수단을 선택한다$") public void 틴캐시_결제수단을_선택한다() throws Throwable { // 라디오 버튼 사용으로 상품권 선택 WebElement petrol = driver.findElement( By.xpath("//*[@id='common']/table/tbody/tr[2]/td/ul[2]/li[1]/span/input")); if (!petrol.isSelected()) petrol.click(); assertTrue(petrol.isSelected()); // 라디오 그룹 자동화 테스트 List<WebElement> fuel_type = (List<WebElement>) driver.findElements(By.name("spgid")); for (WebElement type : fuel_type) { if (type.getAttribute("value").equals("gift")) { if (!type.isSelected()) type.click(); assertTrue(type.isSelected()); break; } } Select make = new Select(driver.findElement(By.name("spgid_gift"))); assertFalse(make.isMultiple()); make.selectByVisibleText("틴캐시"); assertEquals("틴캐시", make.getFirstSelectedOption().getText()); }
@Test public void shouldIndicateThatASelectCanSupportMultipleOptionsWithFalseMultipleAttribute() { WebElement selectElement = driver.findElement(By.name("multi_false")); Select select = new Select(selectElement); assertTrue(select.isMultiple()); }
@Test public void shouldNotIndicateThatANormalSelectSupportsMulitpleOptions() { WebElement selectElement = driver.findElement(By.name("selectomatic")); Select select = new Select(selectElement); assertFalse(select.isMultiple()); }