public class HtmlEvalUtil extends HtmlTagUtil
Modifier and Type | Field and Description |
---|---|
static String[] |
EVENT_FOCUS |
static String[] |
EVENT_LOAD |
static String[] |
EVENT_MOUSE_BUTTON |
static String[] |
EVENT_MOUSE_FOCUS |
static String[] |
EVENT_ON_KEY |
static String[] |
EVENT_WINDOW |
ATTR_ALT, ATTR_HREF, ATTR_SRC, ATTR_TITLE, FLASH_CODEBASE, FLASH_OBJECT, FLASH_PLUGINSPAGE, FLASH_TYPE
ATTR_ONABORT, ATTR_ONBLUR, ATTR_ONCLICK, ATTR_ONDBLCLICK, ATTR_ONDRAGDROP, ATTR_ONERROR, ATTR_ONFOCUS, ATTR_ONKEYDOWN, ATTR_ONKEYPRESS, ATTR_ONKEYUP, ATTR_ONLOAD, ATTR_ONMOUSEDOWN, ATTR_ONMOUSEMOVE, ATTR_ONMOUSEOUT, ATTR_ONMOUSEOVER, ATTR_ONMOUSEUP, ATTR_ONMOVE, ATTR_ONRESIZE, ATTR_ONSELECT, ATTR_ONUNLOAD
Constructor and Description |
---|
HtmlEvalUtil(Document target,
Document resultDoc,
String url,
Map<Node,Integer> document2IdMap,
Document srcDom,
Document liveDom,
PageData pageData,
boolean isDBCS,
boolean isLive)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
appendErrorIcon(IProblemItem pitem,
Element original)
Append an error icon to an element in the blind view.
|
List<Element> |
getAccessKeyElements()
Get all elements that has accessKey.
|
List<Element> |
getAppletElements()
Get all applet elements.
|
List<Element> |
getAreaElements()
Get all area elements.
|
Element[] |
getAWithHref_elements()
Get array of anchor
Element who has href attribute |
String[] |
getAWithHref_hrefs()
Get target hrefs of anchor Elements
|
String[] |
getAWithHref_strings()
Get text descendant of anchor
Element who has href attribute |
URL |
getBaseUrl()
Get base URL of the target page
|
Element[] |
getBody_elements()
Get body
Element |
Element[] |
getBottom_1row1col_tables()
Get tables who has 1 row and 1 column
|
Element[] |
getBottom_data_tables()
Get bottom data tables in the nested table
|
Element[] |
getBottom_notdata_tables()
Get bottom tables (not data table) in the nested table
|
Map<Node,Integer> |
getDocument2IdMap()
Get map between
Node and ACTF_ID |
List<Element> |
getElementsList(Node node,
String tagName,
String... tagNames)
Utility function similar to getElementsByTagName() that returns a List
instance instead of a NodeList instance.
|
List<Element> |
getElementsWithId()
Get all elements that has id attribute.
|
List<Element> |
getElementsWithStyle()
Get all elements that has style attribute.
|
Element[] |
getEmbed_elements()
Get all embed
Element in the page |
Element[] |
getEventFocusElements()
Get array of
Element that has focus event handler (onfocus,
onblur or onselect) |
Element[] |
getEventLoadElements()
Get array of
Element that has event handler (onload, onunload,
onabort or onerror) |
Element[] |
getEventMouseButtonElements()
Get array of
Element that has mouse event handler (onclick,
ondblclick, onmouseup or onmousedown) |
Element[] |
getEventOnKeyElements()
Get array of
Element that has onkey event handler (onkeydown,
onkeyup or onkeypress) |
Element[] |
getEventOnMouseElements()
Get array of
Element that has onmouse event handler (onmouseover,
onmouseout or onmousemove) |
Element[] |
getEventWindowElements()
Get array of
Element that has window event handler (onresize,
onmove or ondragdrop) |
Element[] |
getFrame_elements()
Get frame
Element in the page |
int |
getHeadingLevel(String strNodeName)
Get heading level as int
|
Element[] |
getHeadings()
Get all heading
Element in the page |
Element[] |
getIframe_elements()
Get all iframe
Element in the page |
List<Element> |
getImageButtons()
Get all image button (input elements whose type is "image").
|
org.w3c.dom.html.HTMLImageElement[] |
getImg_elements()
Get all img
Element in the page |
double |
getInvalidLinkRatio()
Get invalid link ratio of the page.
|
int |
getInvisibleElementCount()
Deprecated.
|
String[] |
getInvisibleLinkStrings()
Deprecated.
|
Element[] |
getJavascriptHref_elements()
Get all
<a href="javascript:...
|
String[] |
getJavascriptHref_hrefs()
Get all href Strings of
<a href="javascript:...
|
String[] |
getJavascriptHref_strings()
Get text descendant of anchor
Element for JavaScript |
Document |
getLiveDom()
Get live DOM
|
File |
getLiveFile()
Get HTML file that represents live DOM
|
HashSet<String> |
getNotExistHrefSet()
Deprecated.
|
Element[] |
getObject_elements()
Get all object
Element in the page |
PageData |
getPageData()
Get target page information as
PageData |
Element[] |
getParent_table_elements()
Get array of parent table elements of nested tables.
|
Document |
getResult()
Get visualization result
Document |
Element[] |
getScript_elements()
Get all script
Element |
Document |
getSrcDom()
Get source DOM
|
File |
getSrcFile()
Get source HTML file
|
List<Element> |
getStyleElements()
Get all style elements.
|
Element[] |
getTable_elements()
Get all table
Element in the page |
Document |
getTarget()
Get target
Document |
File |
getTargetFile()
Get evaluation target HTML file
|
List<Element> |
getTextButtons()
Get all text-based button.
|
String |
getUrl()
Get URL of the page
|
boolean |
isDBCS()
Check if the target page uses DBCS
|
boolean |
isHasAwithHref()
Check if the page has
<a href="">
|
boolean |
isHasJavascript()
Check if the page uses JavaScript
|
boolean |
isLiveDom()
Check if the target DOM is live DOM
|
void |
setLiveFile(File liveFile)
Set HTML file that represents live DOM
|
void |
setSrcFile(File srcFile)
Set source HTML file
|
void |
setTargetFile(File targetFile)
Set evaluation target HTML file
|
getAncestor, getBlockElementSet, getImgElementsFromMap, getNoScriptText, getTextAltDescendant, getTextDescendant, hasAncestor, hasTextDescendant, isBlankString, isButtonControl, isTextControl
public static final String[] EVENT_MOUSE_BUTTON
public static final String[] EVENT_MOUSE_FOCUS
public static final String[] EVENT_ON_KEY
public static final String[] EVENT_LOAD
public static final String[] EVENT_WINDOW
public static final String[] EVENT_FOCUS
public HtmlEvalUtil(Document target, Document resultDoc, String url, Map<Node,Integer> document2IdMap, Document srcDom, Document liveDom, PageData pageData, boolean isDBCS, boolean isLive)
target
- target Document
resultDoc
- visualization result Document
url
- target URLdocument2IdMap
- map between Node
and ACTF_IDsrcDom
- the original source Document
liveDom
- the live Document
obtained from browserpageData
- the detailed page information as PageData
isDBCS
- true if target page uses DBCSisLive
- true if target is live DOMpublic List<Element> getElementsList(Node node, String tagName, String... tagNames)
el
- an Element or Document instancetagName
- the name of element which you want look fortagNames
- optional list of element names which you want look forList
of elements with given tag name that are descendants
of the node.public int getHeadingLevel(String strNodeName)
strNodeName
- target Heading tag name (H1, H2,..., H6)public List<Element> getAccessKeyElements()
public List<Element> getElementsWithStyle()
public List<Element> getElementsWithId()
public Element[] getAWithHref_elements()
Element
who has href attributeElement
who has href attributepublic String[] getAWithHref_hrefs()
public String[] getAWithHref_strings()
Element
who has href attributeElement
who has href attributeHtmlTagUtil.getTextAltDescendant(Node)
public URL getBaseUrl()
public Element[] getBottom_1row1col_tables()
Element
who has 1 row and 1 columnpublic Element[] getBottom_data_tables()
public Element[] getBottom_notdata_tables()
public String getUrl()
public Map<Node,Integer> getDocument2IdMap()
Node
and ACTF_IDNode
and ACTF_IDpublic Element[] getFrame_elements()
Element
in the pagepublic boolean isHasAwithHref()
<a href="">
public boolean isHasJavascript()
public Element[] getHeadings()
Element
in the pagepublic Document getLiveDom()
public Element[] getIframe_elements()
Element
in the pagepublic org.w3c.dom.html.HTMLImageElement[] getImg_elements()
Element
in the pagepublic List<Element> getImageButtons()
public double getInvalidLinkRatio()
public int getInvisibleElementCount()
Element
public String[] getInvisibleLinkStrings()
Element
public boolean isDBCS()
public boolean isLiveDom()
public HashSet<String> getNotExistHrefSet()
public Element[] getObject_elements()
Element
in the pagepublic Document getSrcDom()
public PageData getPageData()
PageData
public Element[] getParent_table_elements()
public Element[] getTable_elements()
Element
in the pagepublic Element[] getEmbed_elements()
Element
in the pagepublic Element[] getJavascriptHref_elements()
<a href="javascript:..."elements
public String[] getJavascriptHref_hrefs()
<a href="javascript:..."elements
public String[] getJavascriptHref_strings()
Element
for JavaScriptElement
for JavaScriptHtmlTagUtil.getTextAltDescendant(Node)
public Element[] getEventLoadElements()
Element
that has event handler (onload, onunload,
onabort or onerror)public Element[] getEventMouseButtonElements()
Element
that has mouse event handler (onclick,
ondblclick, onmouseup or onmousedown)public Element[] getEventOnMouseElements()
Element
that has onmouse event handler (onmouseover,
onmouseout or onmousemove)public Element[] getEventOnKeyElements()
Element
that has onkey event handler (onkeydown,
onkeyup or onkeypress)public Element[] getScript_elements()
Element
public Element[] getEventWindowElements()
Element
that has window event handler (onresize,
onmove or ondragdrop)public Element[] getEventFocusElements()
Element
that has focus event handler (onfocus,
onblur or onselect)public File getTargetFile()
public void setTargetFile(File targetFile)
public File getSrcFile()
public void setSrcFile(File srcFile)
public File getLiveFile()
public void setLiveFile(File liveFile)
public boolean appendErrorIcon(IProblemItem pitem, Element original)
pitem
- original
-