Changeset 4780 for devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/Page.java
- Timestamp:
- 07/18/11 10:56:36 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/testlink/automation2.0/src/test/java/org/expressolivre/cte/pages/common/Page.java
r4620 r4780 146 146 * Valor a ser selecionado. 147 147 */ 148 public void setComboValue(WebElement element, String value) { 149 List<WebElement> options = element.findElements(By.tagName("option")); 150 for (WebElement option : options) { 151 if (option.getText().equals(value)) { 152 option.setSelected(); 153 return; 154 } 148 public boolean setComboValue(WebElement element, String value) { 149 150 try { 151 List<WebElement> options = element.findElements(By 152 .tagName("option")); 153 for (WebElement option : options) { 154 if (option.getText().equals(value)) { 155 option.setSelected(); 156 return true; 157 } 158 } 159 } catch (NoSuchElementException nsee) { 160 System.out.println("Warning: ELEMENTO NAO ENCONTRADO!"); 161 return false; 155 162 } 156 163 … … 165 172 e.printStackTrace(); 166 173 } 174 return false; 167 175 } 168 176 … … 177 185 } 178 186 187 /** 188 * Verifica se um element esta presente na tela. 189 * 190 * @param by 191 * @return 192 */ 193 public Boolean isElementPresent(By by) { 194 boolean find = true; 195 try { 196 driver.findElement(by); 197 } catch (NoSuchElementException nsee) { 198 find = false; 199 } 200 return find; 201 } 202 179 203 }
Note: See TracChangeset
for help on using the changeset viewer.