PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/src/test/java/org/sigmah/endtoend/page/GxtComboBox.java

http://sigma-h.googlecode.com/
Java | 37 lines | 26 code | 7 blank | 4 comment | 0 complexity | a43e5457779186ce0c917dcb4cdf308e MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.endtoend.page;
 7
 8import org.openqa.selenium.WebElement;
 9import org.sigmah.endtoend.xpath.ext.HtmlXPath;
10
11import static org.sigmah.endtoend.xpath.XPath.*;
12import static org.sigmah.endtoend.xpath.ext.GxtXPath.isFormTrigger;
13
14public class GxtComboBox extends GxtComponent {
15    public GxtComboBox(WebElement element) {
16        super(element);
17    }
18
19    public void trigger() {
20        find(isFormTrigger()).click();
21    }
22
23    public GxtComponent findList() {
24        return findAbsolute(
25                descendant(element("body")),
26                child(HtmlXPath.ofClass("x-combo-list")));
27    }
28
29    public void trigger(String valueToSelect) {
30        trigger();
31        findAbsolute(
32                descendant(element("body")),
33                child(HtmlXPath.ofClass("x-combo-list")),
34                descendant(havingTextEqualTo(valueToSelect))
35        ).click();
36    }
37}