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

Extends the default WebElement with Opera specific methods.

Author:
Deniz Turkoglu

Field Summary
protected  java.util.logging.Logger logger
           
 
Fields inherited from class org.openqa.selenium.remote.RemoteWebElement
id, mouse
 
Constructor Summary
OperaWebElement(OperaDriver parent, int objectId)
           
 
Method Summary
 java.lang.String callMethod(java.lang.String method)
          Calls the method and parses the result, the result must be a string
 void clear()
           
 void click()
           
 void click(int times)
          Click this element many times.
 void click(int x, int y)
          Click the element at the given x, y offset from the top left.
 boolean containsColor(OperaColors... colors)
           
 void dragAndDropBy(int x, int y)
          Deprecated.  
 void dragAndDropOn(org.openqa.selenium.WebElement element)
          Deprecated.  
 boolean equals(java.lang.Object obj)
           
protected  void finalize()
           
 org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
           
protected  org.openqa.selenium.WebElement findElement(java.lang.String by, java.lang.String using)
           
 org.openqa.selenium.WebElement findElementByName(java.lang.String using)
           
 java.util.List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
           
protected  java.util.List<org.openqa.selenium.WebElement> findElements(java.lang.String by, java.lang.String using)
           
 java.util.List<org.openqa.selenium.WebElement> findElementsByName(java.lang.String using)
           
 java.lang.String getAttribute(java.lang.String attribute)
           
 org.openqa.selenium.interactions.internal.Coordinates getCoordinates()
           
 java.lang.String getCssValue(java.lang.String property)
           
 java.lang.String getElementName()
          Get the tag name of this element.
 java.lang.String getImageHash()
          Takes a screenshot of the area this element's bounding-box covers and returns the MD5 hash.
 java.lang.String getImageHash(long timeout, java.lang.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()
           
 java.lang.String getTagName()
           
 java.lang.String getText()
           
 java.lang.String getValue()
          Deprecated. 
 org.openqa.selenium.WebDriver getWrappedDriver()
           
 int hashCode()
           
 void hover()
          Deprecated. Use mouseOver()
 boolean isDisplayed()
           
 boolean isEnabled()
           
 boolean isSelected()
           
 boolean isVisible()
          Deprecated. Use isDisplayed() instead
 void middleClick()
          Click the middle mouse button at the top left of the element.
 void mouseDown()
          Presses the left mouse button down on the top left of the element.
 void mouseOut()
          Moves the mouse from the top left of the element to the top left of the page, generating a mouseOut event.
 void mouseOver()
           
 void mouseUp()
          Releases the left mouse button at the top left of the element.
 void rightClick()
          Right clicks on the element.
 ScreenShotReply saveScreenshot(long timeout, java.lang.String... hashes)
          Take a screenshot of the area this element's bounding-box covers.
 java.lang.String saveScreenshot(java.lang.String filename)
          Take a screenshot of the area this element's bounding-box covers.
 java.lang.String saveScreenshot(java.lang.String filename, long timeout)
          Take a screenshot of the area this element covers.
 java.lang.String saveScreenshot(java.lang.String filename, long timeout, boolean includeImage, java.lang.String... hashes)
           
 void sendKeys(java.lang.CharSequence... keysToSend)
           
 void setSelected()
          Deprecated. Please use "click" instead
static void sleep(long ms)
           
 void submit()
           
 boolean toggle()
          Deprecated. To be removed. Determine the current state using isSelected()
 java.lang.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, setId, setParent
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final java.util.logging.Logger logger
Constructor Detail

OperaWebElement

public OperaWebElement(OperaDriver parent,
                       int objectId)
Method Detail

getObjectId

public int getObjectId()

getRuntimeId

public int getRuntimeId()

callMethod

public final java.lang.String callMethod(java.lang.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

rightClick

public void rightClick()
Right clicks on the element.


hover

@Deprecated
public void hover()
Deprecated. Use mouseOver()


mouseOver

public void mouseOver()

mouseOut

public void mouseOut()
Moves the mouse from the top left of the element to the top left of the page, generating a mouseOut event.


mouseDown

public void mouseDown()
Presses the left mouse button down on the top left of the element.


mouseUp

public void mouseUp()
Releases the left mouse button at the top left of the element.


click

public void click(int times)
Click this element many times.

Parameters:
times - The number of times to click

middleClick

public void middleClick()
Click the middle mouse button at the top left of the element.


click

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

click

public void click(int x,
                  int y)
Click the element at the given x, y offset from the top left.

Parameters:
x - The distance from the left to click
y - The distance from the top to click

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 java.util.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 java.lang.String getAttribute(java.lang.String attribute)
Specified by:
getAttribute in interface org.openqa.selenium.WebElement
Overrides:
getAttribute in class org.openqa.selenium.remote.RemoteWebElement

getElementName

public java.lang.String getElementName()
Get the tag name of this element.

Returns:
the tag name in upper-case

getText

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

getValue

@Deprecated
public java.lang.String getValue()
Deprecated. 


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

isVisible

@Deprecated
public boolean isVisible()
Deprecated. Use isDisplayed() instead


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(java.lang.CharSequence... keysToSend)
Specified by:
sendKeys in interface org.openqa.selenium.WebElement
Overrides:
sendKeys in class org.openqa.selenium.remote.RemoteWebElement

setSelected

@Deprecated
public void setSelected()
Deprecated. Please use "click" instead

Overrides:
setSelected 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

toggle

@Deprecated
public boolean toggle()
Deprecated. To be removed. Determine the current state using isSelected()

Overrides:
toggle in class org.openqa.selenium.remote.RemoteWebElement

sleep

public static void sleep(long ms)

dragAndDropBy

@Deprecated
public void dragAndDropBy(int x,
                                     int y)
Deprecated. 

To be replaced by the advanced interactions API.


dragAndDropOn

@Deprecated
public void dragAndDropOn(org.openqa.selenium.WebElement element)
Deprecated. 

To be replaced by the advanced interactions API.


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 java.lang.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 java.lang.String getImageHash(long timeout,
                                     java.lang.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 java.lang.String saveScreenshot(java.lang.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 java.lang.String saveScreenshot(java.lang.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 java.lang.String saveScreenshot(java.lang.String filename,
                                       long timeout,
                                       boolean includeImage,
                                       java.lang.String... hashes)

saveScreenshot

public ScreenShotReply saveScreenshot(long timeout,
                                      java.lang.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.

containsColor

public boolean containsColor(OperaColors... colors)

getTagName

public java.lang.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

equals

public boolean equals(java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object

findElement

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

findElements

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

findElementByName

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

findElementsByName

public java.util.List<org.openqa.selenium.WebElement> findElementsByName(java.lang.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 java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.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 java.lang.String getCssValue(java.lang.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 © 2011. All Rights Reserved.