View Javadoc

1   package com.atlassian.pageobjects.elements;
2   
3   import com.atlassian.pageobjects.elements.timeout.TimeoutType;
4   import org.openqa.selenium.By;
5   
6   /**
7    * WebDriver-based implementation of {@link CheckboxElement}
8    */
9   public class WebDriverCheckboxElement extends WebDriverElement implements CheckboxElement
10  {
11      public WebDriverCheckboxElement(By locator)
12      {
13          super(locator);
14      }
15  
16      public WebDriverCheckboxElement(By locator, TimeoutType defaultTimeout)
17      {
18          super(locator, defaultTimeout);
19      }
20  
21      public WebDriverCheckboxElement(WebDriverLocatable locatable, TimeoutType timeoutType)
22      {
23          super(locatable, timeoutType);
24      }
25  
26      public WebDriverCheckboxElement(By locator, WebDriverLocatable parent)
27      {
28          super(locator, parent);
29      }
30  
31      public WebDriverCheckboxElement(By locator, WebDriverLocatable parent, TimeoutType timeoutType)
32      {
33          super(locator, parent, timeoutType);
34      }
35  
36      @Override
37      public boolean isChecked()
38      {
39          return isSelected();
40      }
41  
42      public CheckboxElement check()
43      {
44          select();
45          return this;
46      }
47  
48      public CheckboxElement uncheck()
49      {
50          if(isSelected())
51          {
52              toggle();
53          }
54          return this;
55      }
56  }