Changeset 3766 for devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages/common/Page.java
- Timestamp:
- 02/15/11 16:04:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/testlink/automation2.0/src/test/java/br/gov/serpro/expresso/cte/pages/common/Page.java
r3745 r3766 17 17 */ 18 18 public class Page { 19 19 20 /** Implementacao do driver a ser utilizado no teste da pagina. */ 20 21 protected WebDriver driver; … … 29 30 30 31 /** 31 * Clica em um elemento.32 * Procura e clica em um elemento de tela. 32 33 * 33 * @param id 34 * Id do elemento a ser clicado. 34 * @param by 35 35 */ 36 public void clickElement(String id) {37 driver.findElement(By.id(id)).click();38 }39 40 36 public void clickElement(By by) { 41 37 driver.findElement(by).click(); … … 49 45 */ 50 46 public void findAndClickElement(String id) { 51 this.waitForElement ById(id);52 this.clickElement( id);47 this.waitForElement(By.id(id)); 48 this.clickElement(By.id(id)); 53 49 } 54 50 55 51 /** 56 * Aguarda por um elemento.52 * Aguarda ate o elemento aparecer na tela. 57 53 * 58 * @param id59 * Id do elemento a ser aguardado.54 * @param by 55 * Element a ser pesquisado, podendo ser por id, xpath, name. 60 56 */ 61 public void waitForElementById(String id) { 62 isDisplayed(this.waitFindElement(By.id(id), 5000, 1000)); 63 } 64 65 /** 66 * @param name 67 */ 68 public void waitForElementByName(String name) { 69 isDisplayed(this.waitFindElement(By.name(name), 5000, 1000)); 70 } 71 72 /** 73 * @param xpath 74 */ 75 public void waitForElementByXpath(String xpath) { 76 isDisplayed(this.waitFindElement(By.xpath(xpath), 5000, 1000)); 57 public void waitForElement(By by) { 58 isDisplayed(this.waitFindElement(by, 5000, 1000)); 77 59 } 78 60 … … 88 70 */ 89 71 public boolean isDisplayed(RenderedWebElement e) { 90 System.out.println("starting tentatives");91 72 // Up to 10 times 92 73 for (int i = 0; i < 10; i++) { 93 System.out.println("tentative " + i);94 74 // Check whether our element is visible yet 95 75 if (e.isDisplayed()) { … … 115 95 116 96 public String getDisplayedElementContent(String id) { 117 waitForElement ById(id);97 waitForElement(By.id(id)); 118 98 return driver.findElement(By.id(id)).getText(); 119 99 } … … 142 122 143 123 /** 124 * Seta o valor de uma combo box. 125 * 144 126 * @param element 127 * Combo box. 145 128 * @param value 129 * Valor a ser selecionado. 146 130 */ 147 131 public void setComboValue(WebElement element, String value) {
Note: See TracChangeset
for help on using the changeset viewer.