Ignore:
Timestamp:
02/15/11 16:04:00 (13 years ago)
Author:
luiz-fernando
Message:

Ticket #1402 - Novos casos de teste implementados usando WebDriver?

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  
    1717 */ 
    1818public class Page { 
     19 
    1920        /** Implementacao do driver a ser utilizado no teste da pagina. */ 
    2021        protected WebDriver driver; 
     
    2930 
    3031        /** 
    31          * Clica em um elemento. 
     32         * Procura e clica em um elemento de tela. 
    3233         *  
    33          * @param id 
    34          *            Id do elemento a ser clicado. 
     34         * @param by 
    3535         */ 
    36         public void clickElement(String id) { 
    37                 driver.findElement(By.id(id)).click(); 
    38         } 
    39  
    4036        public void clickElement(By by) { 
    4137                driver.findElement(by).click(); 
     
    4945         */ 
    5046        public void findAndClickElement(String id) { 
    51                 this.waitForElementById(id); 
    52                 this.clickElement(id); 
     47                this.waitForElement(By.id(id)); 
     48                this.clickElement(By.id(id)); 
    5349        } 
    5450 
    5551        /** 
    56          * Aguarda por um elemento. 
     52         * Aguarda ate o elemento aparecer na tela. 
    5753         *  
    58          * @param id 
    59          *            Id do elemento a ser aguardado. 
     54         * @param by 
     55         *            Element a ser pesquisado, podendo ser por id, xpath, name. 
    6056         */ 
    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)); 
    7759        } 
    7860 
     
    8870         */ 
    8971        public boolean isDisplayed(RenderedWebElement e) { 
    90                 System.out.println("starting tentatives"); 
    9172                // Up to 10 times 
    9273                for (int i = 0; i < 10; i++) { 
    93                         System.out.println("tentative " + i); 
    9474                        // Check whether our element is visible yet 
    9575                        if (e.isDisplayed()) { 
     
    11595 
    11696        public String getDisplayedElementContent(String id) { 
    117                 waitForElementById(id); 
     97                waitForElement(By.id(id)); 
    11898                return driver.findElement(By.id(id)).getText(); 
    11999        } 
     
    142122 
    143123        /** 
     124         * Seta o valor de uma combo box. 
     125         *  
    144126         * @param element 
     127         *            Combo box. 
    145128         * @param value 
     129         *            Valor a ser selecionado. 
    146130         */ 
    147131        public void setComboValue(WebElement element, String value) { 
Note: See TracChangeset for help on using the changeset viewer.