com.opera.core.systems
Class OperaWebElement

java.lang.Object
  extended by org.openqa.selenium.remote.RemoteWebElement
      extended by com.opera.core.systems.OperaWebElement
All Implemented Interfaces:
org.openqa.selenium.internal.FindsByClassName, org.openqa.selenium.internal.FindsByCssSelector, org.openqa.selenium.internal.FindsById, org.openqa.selenium.internal.FindsByLinkText, org.openqa.selenium.internal.FindsByName, org.openqa.selenium.internal.FindsByTagName, org.openqa.selenium.internal.FindsByXPath, org.openqa.selenium.internal.Locatable, org.openqa.selenium.internal.WrapsDriver, org.openqa.selenium.SearchContext, org.openqa.selenium.WebElement

public class OperaWebElement
extends org.openqa.selenium.remote.RemoteWebElement

Implements WebDriver's WebElement, but also extends it with Opera specific methods.


Field Summary
protected  Logger logger
           
 
Fields inherited from class org.openqa.selenium.remote.RemoteWebElement
fileDetector, id, mouse
 
Constructor Summary
OperaWebElement(OperaDriver parent, int objectId)
           
 
Method Summary
 String callMethod(String method)
          Calls the method and parses the result, the result must be a string
 void clear()
           
 void click()
           
 boolean containsColor(OperaColors... colors)
          Deprecated.  
 boolean equals(Object obj)
           
protected  void finalize()
           
 org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
           
protected  org.openqa.selenium.WebElement findElement(String by, String using)
           
 org.openqa.selenium.WebElement findElementByName(String using)
           
 List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
           
protected  List<org.openqa.selenium.WebElement> findElements(String by, String using)
           
 List<org.openqa.selenium.WebElement> findElementsByName(String using)
           
 String getAttribute(String attribute)
           
 org.openqa.selenium.interactions.internal.Coordinates getCoordinates()
           
 String getCssValue(String property)
           
 String getImageHash()
          Takes a screenshot of the area this element's bounding-box covers and returns the MD5 hash.
 String getImageHash(long timeout, String... hashes)
          Takes a screenshot after timeout milliseconds of the area this element's bounding-box covers and returns the MD5 hash.
 org.openqa.selenium.Point getLocation()
          Click top left, can be modified to click in the middle
 org.openqa.selenium.Point getLocationOnScreenOnceScrolledIntoView()
           
 int getObjectId()
           
 int getRuntimeId()
           
 org.openqa.selenium.Dimension getSize()
           
 String getTagName()
           
 String getText()
           
 org.openqa.selenium.WebDriver getWrappedDriver()
           
 int hashCode()
           
 boolean isDisplayed()
           
 boolean isEnabled()
           
 boolean isSelected()
           
 void middleClick()
          Deprecated.  
 ScreenShotReply saveScreenshot(long timeout, String... hashes)
          Take a screenshot of the area this element's bounding-box covers.
 String saveScreenshot(String filename)
          Take a screenshot of the area this element's bounding-box covers.
 String saveScreenshot(String filename, long timeout)
          Take a screenshot of the area this element covers.
 String saveScreenshot(String filename, long timeout, boolean includeImage, String... hashes)
          Take a screenshot of the area this element covers.
 void sendKeys(CharSequence... keysToSend)
           
 void submit()
           
 String toString()
           
 
Methods inherited from class org.openqa.selenium.remote.RemoteWebElement
execute, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, getId, setFileDetector, setFoundBy, setId, setParent
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final Logger logger
Constructor Detail

OperaWebElement

public OperaWebElement(OperaDriver parent,
                       int objectId)
Parameters:
parent - driver that this element belongs to
objectId - the EcmaScript object ID of this element
Method Detail

callMethod

public final String callMethod(String method)
Calls the method and parses the result, the result must be a string

Parameters:
method - the method to call
Returns:
response of EcmaScript in string presentation

click

public void click()
Specified by:
click in interface org.openqa.selenium.WebElement
Overrides:
click in class org.openqa.selenium.remote.RemoteWebElement

middleClick

@Deprecated
public void middleClick()
Deprecated. 

Click the middle mouse button at the top left corner of the element. Will not verify whether element is available for interaction first.


findElement

public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
Specified by:
findElement in interface org.openqa.selenium.SearchContext
Specified by:
findElement in interface org.openqa.selenium.WebElement
Overrides:
findElement in class org.openqa.selenium.remote.RemoteWebElement

findElements

public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
Specified by:
findElements in interface org.openqa.selenium.SearchContext
Specified by:
findElements in interface org.openqa.selenium.WebElement
Overrides:
findElements in class org.openqa.selenium.remote.RemoteWebElement

getAttribute

public String getAttribute(String attribute)
Specified by:
getAttribute in interface org.openqa.selenium.WebElement
Overrides:
getAttribute in class org.openqa.selenium.remote.RemoteWebElement

getText

public String getText()
Specified by:
getText in interface org.openqa.selenium.WebElement
Overrides:
getText in class org.openqa.selenium.remote.RemoteWebElement

isDisplayed

public boolean isDisplayed()
Specified by:
isDisplayed in interface org.openqa.selenium.WebElement
Overrides:
isDisplayed in class org.openqa.selenium.remote.RemoteWebElement

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface org.openqa.selenium.WebElement
Overrides:
isEnabled in class org.openqa.selenium.remote.RemoteWebElement

isSelected

public boolean isSelected()
Specified by:
isSelected in interface org.openqa.selenium.WebElement
Overrides:
isSelected in class org.openqa.selenium.remote.RemoteWebElement

clear

public void clear()
Specified by:
clear in interface org.openqa.selenium.WebElement
Overrides:
clear in class org.openqa.selenium.remote.RemoteWebElement

sendKeys

public void sendKeys(CharSequence... keysToSend)
Specified by:
sendKeys in interface org.openqa.selenium.WebElement
Overrides:
sendKeys in class org.openqa.selenium.remote.RemoteWebElement

submit

public void submit()
Specified by:
submit in interface org.openqa.selenium.WebElement
Overrides:
submit in class org.openqa.selenium.remote.RemoteWebElement

getLocation

public org.openqa.selenium.Point getLocation()
Click top left, can be modified to click in the middle

Specified by:
getLocation in interface org.openqa.selenium.WebElement
Overrides:
getLocation in class org.openqa.selenium.remote.RemoteWebElement

getSize

public org.openqa.selenium.Dimension getSize()
Specified by:
getSize in interface org.openqa.selenium.WebElement
Overrides:
getSize in class org.openqa.selenium.remote.RemoteWebElement

getImageHash

public String getImageHash()
Takes a screenshot of the area this element's bounding-box covers and returns the MD5 hash.

Returns:
an MD5 hash as a string

getImageHash

public String getImageHash(long timeout,
                           String... hashes)
Takes a screenshot after timeout milliseconds of the area this element's bounding-box covers and returns the MD5 hash.

Parameters:
timeout - the number of milliseconds to wait before taking the screenshot
hashes - optional hashes to compare the hashes with
Returns:
an MD5 hash as a string

saveScreenshot

public String saveScreenshot(String filename)
Take a screenshot of the area this element's bounding-box covers. Saves a copy of the image to the given filename, and returns an MD5 hash of the image.

Parameters:
filename - the location to save the screenshot
Returns:
the MD5 hash of the screenshot

saveScreenshot

public String saveScreenshot(String filename,
                             long timeout)
Take a screenshot of the area this element covers. Saves a copy of the image to the given filename.

Parameters:
filename - the location to save the screenshot
timeout - the number of milliseconds to wait before taking the screenshot
Returns:
the MD5 hash of the screenshot

saveScreenshot

public String saveScreenshot(String filename,
                             long timeout,
                             boolean includeImage,
                             String... hashes)
Take a screenshot of the area this element covers. If the hash of the image matches any of the given hashes then no image is saved, otherwise it saves a copy of the image to the given filename.

Parameters:
filename - the location to save the screenshot
timeout - the number of milliseconds to wait before taking the screenshot
includeImage - whether to get the image data. Disable if you just need the MD5 hash
hashes - known image hashes
Returns:
the MD5 hash of the screenshot

saveScreenshot

public ScreenShotReply saveScreenshot(long timeout,
                                      String... hashes)
Take a screenshot of the area this element's bounding-box covers.

Parameters:
timeout - The number of milliseconds to wait before taking the screenshot
hashes - A previous screenshot MD5 hash. If it matches the hash of this screenshot then no image data is returned.
Returns:
a screenshot instance object

containsColor

@Deprecated
public boolean containsColor(OperaColors... colors)
Deprecated. 

Check if the current webpage contains any of the given colors. Used on tests that use red to show a failure.

Parameters:
colors - list of colors to check for.
Returns:
true if the page contains any of the given colors, false otherwise.

getTagName

public String getTagName()
Specified by:
getTagName in interface org.openqa.selenium.WebElement
Overrides:
getTagName in class org.openqa.selenium.remote.RemoteWebElement

getLocationOnScreenOnceScrolledIntoView

public org.openqa.selenium.Point getLocationOnScreenOnceScrolledIntoView()
Specified by:
getLocationOnScreenOnceScrolledIntoView in interface org.openqa.selenium.internal.Locatable
Overrides:
getLocationOnScreenOnceScrolledIntoView in class org.openqa.selenium.remote.RemoteWebElement

getObjectId

public int getObjectId()

getRuntimeId

public int getRuntimeId()

equals

public boolean equals(Object obj)
Overrides:
equals in class org.openqa.selenium.remote.RemoteWebElement

hashCode

public int hashCode()
Overrides:
hashCode in class org.openqa.selenium.remote.RemoteWebElement

toString

public String toString()
Overrides:
toString in class org.openqa.selenium.remote.RemoteWebElement

findElement

protected org.openqa.selenium.WebElement findElement(String by,
                                                     String using)
Overrides:
findElement in class org.openqa.selenium.remote.RemoteWebElement

findElements

protected List<org.openqa.selenium.WebElement> findElements(String by,
                                                            String using)
Overrides:
findElements in class org.openqa.selenium.remote.RemoteWebElement

findElementByName

public org.openqa.selenium.WebElement findElementByName(String using)
Specified by:
findElementByName in interface org.openqa.selenium.internal.FindsByName
Overrides:
findElementByName in class org.openqa.selenium.remote.RemoteWebElement

findElementsByName

public List<org.openqa.selenium.WebElement> findElementsByName(String using)
Specified by:
findElementsByName in interface org.openqa.selenium.internal.FindsByName
Overrides:
findElementsByName in class org.openqa.selenium.remote.RemoteWebElement

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getCoordinates

public org.openqa.selenium.interactions.internal.Coordinates getCoordinates()
Specified by:
getCoordinates in interface org.openqa.selenium.internal.Locatable
Overrides:
getCoordinates in class org.openqa.selenium.remote.RemoteWebElement

getCssValue

public String getCssValue(String property)
Specified by:
getCssValue in interface org.openqa.selenium.WebElement
Overrides:
getCssValue in class org.openqa.selenium.remote.RemoteWebElement

getWrappedDriver

public org.openqa.selenium.WebDriver getWrappedDriver()
Specified by:
getWrappedDriver in interface org.openqa.selenium.internal.WrapsDriver
Overrides:
getWrappedDriver in class org.openqa.selenium.remote.RemoteWebElement


Copyright © 2012. All Rights Reserved.