|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.mcp.MCP
public class MCP
The main class for the Mozilla Control Program. Please see the package description for an overview.
Constructor Summary | |
---|---|
MCP()
Creates a new instance of MCP |
Method Summary | |
---|---|
void |
addAjaxListener(AjaxListener listener)
Add the argument AjaxListener to this MCP
instance. |
void |
addKeyListener(java.awt.event.KeyListener listener)
Add the argument KeyListener to the
Canvas for this MCP instance. |
void |
addMouseListener(java.awt.event.MouseListener listener)
Add the argument MouseListener to the
Canvas for this MCP instance. |
void |
appendKeyCodeToCurrentElementText(int keyCode)
|
void |
blockingClickElement(org.w3c.dom.Element element)
Find the DOM element within the current page matching the argument id using findElement(java.lang.String) . |
void |
blockingClickElement(java.lang.String idOrName)
Find the DOM element within the current page matching the argument id using findElement(java.lang.String) . |
void |
blockingLoad(java.lang.String url)
Load the url, blocking until the load has completed. |
void |
clickElement(org.w3c.dom.Element element)
Find the DOM element within the current page matching the argument id using findElement(java.lang.String) . |
void |
clickElement(java.lang.String id)
Find the DOM element within the current page matching the argument id using findElement(java.lang.String) . |
void |
deleteBrowserControl()
Make invisible, and delete the BrowserControl
instance for this MCP instance. |
org.w3c.dom.Element |
findElement(java.lang.String id)
Return the DOM Element with the given id or name. |
org.w3c.dom.Element |
findElementById(java.lang.String id)
|
boolean |
findInPage(java.lang.String toFind)
Return true if and only if the argument
toFind occurs within the current page. |
void |
focusElement(org.w3c.dom.Element toFocus)
|
java.util.List<org.w3c.dom.Element> |
getAnchors()
Return a List of DOM Element instances that are HTML anchors that are
present in the document. |
java.util.List<org.w3c.dom.Element> |
getAnchors(java.lang.String id)
Given an argument id , return a List of DOM
Element instances that are HTML anchors that are
direct or indirect children of the element with that id . |
BrowserControl |
getBrowserControl()
Return the Webclient BrowserControl instance used
by this MCP instance. |
java.util.List<org.w3c.dom.Element> |
getChildElementsWithTagName(org.w3c.dom.Element root,
java.lang.String tagName)
Return a List of DOM Element instances whose
tagName attribute is equal to the argument tagName . |
java.util.List<org.w3c.dom.Element> |
getChildElementsWithTagName(java.lang.String id,
java.lang.String tagName)
Return a List of DOM Element instances whose
tagName attribute is equal to the argument tagName . |
java.awt.Frame |
getRealizedVisibleBrowserWindow()
Return the realized and visible java.awt.Frame
containing the actual browser window. |
long |
getTimeout()
Return the number of milliseconds that must elapse before the TimeoutHandler is called. |
TimeoutHandler |
getTimeoutHandler()
Return the currently installed TimeoutHandler , if
any. |
long |
getTimeoutWaitInterval()
Return the number of milliseconds to wait between timeout checks. |
void |
removeAjaxListener(AjaxListener listener)
Remove the argument AjaxListener to this MCP
instance. |
void |
removeKeyListener(java.awt.event.KeyListener listener)
Remove the argument KeyListener from the
Canvas for this MCP instance. |
void |
removeMouseListener(java.awt.event.MouseListener listener)
Remove the argument MouseListener from the
Canvas for this MCP instance. |
void |
setAppData(java.lang.String absolutePathToNativeBrowserBinDir)
|
void |
setBounds(int x,
int y,
int width,
int height)
|
void |
setTimeout(long Timeout)
Set the number of milliseconds that must elapse before the TimeoutHandler is called, if such an instance has been
installed via a previous call to @setTimeoutHandler . |
void |
setTimeoutHandler(TimeoutHandler timeoutHandler)
Install an instance of TimeoutHandler that will be
used for all subsequent browser interactions (clicks, loads, Ajax
transactions, etc). |
void |
setTimeoutWaitInterval(long waitInterval)
Set the number of milliseconds to wait between timeout checks. |
boolean |
waitUntilConditionMet(Condition condition)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MCP()
Method Detail |
---|
public void setAppData(java.lang.String absolutePathToNativeBrowserBinDir) throws java.io.FileNotFoundException, java.lang.ClassNotFoundException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public void setBounds(int x, int y, int width, int height)
public void addAjaxListener(AjaxListener listener)
Add the argument AjaxListener
to this MCP
instance.
public void removeAjaxListener(AjaxListener listener)
Remove the argument AjaxListener
to this MCP
instance.
public void addMouseListener(java.awt.event.MouseListener listener)
Add the argument MouseListener
to the
Canvas
for this MCP instance.
public void removeMouseListener(java.awt.event.MouseListener listener)
Remove the argument MouseListener
from the
Canvas
for this MCP instance.
public void addKeyListener(java.awt.event.KeyListener listener)
Add the argument KeyListener
to the
Canvas
for this MCP instance.
public void removeKeyListener(java.awt.event.KeyListener listener)
Remove the argument KeyListener
from the
Canvas
for this MCP instance.
public BrowserControl getBrowserControl()
Return the Webclient BrowserControl
instance used
by this MCP
instance. This is useful for operations
that require more complex browser control than that offered by
MCP
.
public java.awt.Frame getRealizedVisibleBrowserWindow()
Return the realized and visible java.awt.Frame
containing the actual browser window. There is no need to put
this Frame inside of any surrounding Swing or AWT windows. It is
sufficient to stand alone.
public void deleteBrowserControl()
Make invisible, and delete the BrowserControl
instance for this MCP instance. Reset internal state of the
instance so that a subsequent call to getRealizedVisibleBrowserWindow()
will create a new
Frame
.
public org.w3c.dom.Element findElement(java.lang.String id)
Return the DOM Element
with the given id or name.
First, Document.getElementById()
is called, passing
the argument id
. If an element is found, it is
returned. Otherwise, the document is traversed and the first
element encountered with a name
equal to the argument
id
is returned. If no such element exists,
null
is returned.
public org.w3c.dom.Element findElementById(java.lang.String id)
public void focusElement(org.w3c.dom.Element toFocus)
public void appendKeyCodeToCurrentElementText(int keyCode)
public java.util.List<org.w3c.dom.Element> getAnchors(java.lang.String id)
Given an argument id
, return a List of DOM
Element
instances that are HTML anchors that are
direct or indirect children of the element with that id
.
public java.util.List<org.w3c.dom.Element> getAnchors()
Return a List of DOM
Element
instances that are HTML anchors that are
present in the document.
If no such elements exist,
null
is returned.
public java.util.List<org.w3c.dom.Element> getChildElementsWithTagName(org.w3c.dom.Element root, java.lang.String tagName)
Return a List of DOM Element
instances whose
tagName attribute is equal to the argument tagName
.
If no such elements exist,
null
is returned.
public java.util.List<org.w3c.dom.Element> getChildElementsWithTagName(java.lang.String id, java.lang.String tagName)
Return a List of DOM Element
instances whose
tagName attribute is equal to the argument tagName
.
If no such elements exist,
null
is returned.
public boolean findInPage(java.lang.String toFind)
Return true
if and only if the argument
toFind
occurs within the current page. Case is not
significant. Users desiring more detailed find behavior should
use getBrowserControl()
to obtain a reference to the
CurrentPage
interface, which has more advanced
methods pertaining to the current page.
public void clickElement(org.w3c.dom.Element element)
Find the DOM element within the current page matching the
argument id
using findElement(java.lang.String)
. Use
java.awt.Robot
to click the element. Return
immediately after clicking the element.
public void clickElement(java.lang.String id)
Find the DOM element within the current page matching the
argument id
using findElement(java.lang.String)
. Use
java.awt.Robot
to click the element. Return
immediately after clicking the element.
public void blockingClickElement(org.w3c.dom.Element element)
Find the DOM element within the current page matching the
argument id
using findElement(java.lang.String)
. Use
java.awt.Robot
to click the element. Block until the
document load triggered by the click has completed.
public void blockingClickElement(java.lang.String idOrName)
Find the DOM element within the current page matching the
argument id
using findElement(java.lang.String)
. Use
java.awt.Robot
to click the element. Block until the
document load triggered by the click has completed.
public void blockingLoad(java.lang.String url)
Load the url, blocking until the load has completed.
public boolean waitUntilConditionMet(Condition condition)
public TimeoutHandler getTimeoutHandler()
Return the currently installed TimeoutHandler
, if
any.
public void setTimeoutHandler(TimeoutHandler timeoutHandler)
Install an instance of TimeoutHandler
that will be
used for all subsequent browser interactions (clicks, loads, Ajax
transactions, etc). To remove the TimeoutHandler
,
pass null
to this method. If a handler is
installed, the timer is automatically started when a browser
interaction commences. If the browser interaction does not
complete within getTimeout()
milliseconds, the TimeoutHandler.timeout()
method is called on the argument
TimeoutHandler
instance.
public long getTimeout()
Return the number of milliseconds that must elapse before the
TimeoutHandler
is called. Note that a
TimeoutHandler
is only called if the user has
installed one by calling setTimeoutHandler(org.mozilla.mcp.TimeoutHandler)
.
public void setTimeout(long Timeout)
Set the number of milliseconds that must elapse before the
TimeoutHandler
is called, if such an instance has been
installed via a previous call to @setTimeoutHandler
.
public long getTimeoutWaitInterval()
Return the number of milliseconds to wait between timeout checks.
public void setTimeoutWaitInterval(long waitInterval)
Set the number of milliseconds to wait between timeout checks.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |