Advertisement
Guest User

Untitled

a guest
Feb 28th, 2012
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6.  
  7. import java.util.List;
  8. import org.openqa.selenium.*;
  9. import org.openqa.selenium.support.FindBy;
  10.  
  11. /**
  12.  *
  13.  * @author janipav
  14.  */
  15. public class WebButton implements WebElement{
  16.     private WebElement theButton;
  17.     private List<WebElement> elements;            
  18.     private WebDriver driver;
  19.    
  20.     public WebButton(WebDriver driver){
  21.         this.driver = driver;
  22.     }
  23.  
  24.     public void click() {
  25.         theButton.click();
  26.     }
  27.  
  28.     public void submit() {
  29.        theButton.submit();
  30.     }
  31.  
  32.     public void sendKeys(CharSequence... keysToSend) {
  33.         theButton.sendKeys(keysToSend);
  34.     }
  35.  
  36.     public void clear() {
  37.         theButton.clear();
  38.     }
  39.  
  40.     public String getTagName() {
  41.         return theButton.getTagName();
  42.     }
  43.  
  44.     public String getAttribute(String name) {
  45.         return theButton.getAttribute(name);
  46.     }
  47.  
  48.     public boolean isSelected() {
  49.         return theButton.isSelected();
  50.     }
  51.  
  52.     public boolean isEnabled() {
  53.         return theButton.isEnabled();
  54.     }
  55.  
  56.     public String getText() {
  57.         return theButton.getText();
  58.     }
  59.  
  60.     public List<WebElement> findElements(By by) {
  61.         elements = driver.findElements(by);
  62.         return elements;
  63.     }
  64.    
  65.    
  66.  
  67.     public WebElement findElement(By by) {
  68.         theButton = driver.findElement(by);
  69.         return theButton;
  70.     }
  71.  
  72.     public boolean isDisplayed() {
  73.         return theButton.isDisplayed();
  74.     }
  75.  
  76.     public Point getLocation() {
  77.         return theButton.getLocation();
  78.     }
  79.  
  80.     public Dimension getSize() {
  81.         return theButton.getSize();
  82.     }
  83.  
  84.     public String getCssValue(String propertyName) {
  85.         return theButton.getCssValue(propertyName);
  86.     }
  87.    
  88.    
  89.    
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement