All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.remote.server.handler.WebElementHandler Maven / Gradle / Ivy

The newest version!
package org.openqa.selenium.remote.server.handler;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.server.DriverSessions;

public abstract class WebElementHandler extends WebDriverHandler {
  private String elementId;
  
  public WebElementHandler(DriverSessions sessions) {
    super(sessions);
  }
  
  public void setId(String elementId) {
    this.elementId = elementId;
  }
  
  protected WebElement getElement() {
    return getKnownElements().get(elementId);  
  }
  
  protected String getElementAsString() {
    try {
      return elementId + " " + String.valueOf(getElement());
    } catch (RuntimeException e) {
      // Be paranoid!
    }
    
    return elementId + " unknown";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy