class WebHtmlBrowser extends WebDriverWidget
Modifier and Type | Class and Description |
---|---|
(package private) class |
WebHtmlBrowser.Handler
Handler implementation to allow hooking up navigation events.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
currentContextPath
The context-path for which the current handler is built
|
private java.net.URL |
currentResourceBase
The resource-base for which the current handler is built
|
private org.eclipse.jetty.server.handler.ContextHandler |
handler
The custom handler for hooking up navigation events
|
private static java.util.logging.Logger |
LOG
logger
|
websock, widgetId, window
Constructor and Description |
---|
WebHtmlBrowser(int widgetId,
GuiWebSocket websock)
Initialize the web component.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the driver-specific widget.
|
private java.lang.String |
generateContextPath()
Provide a unique context path for this browse.
|
java.lang.Object |
invokeWidgetCommand(java.lang.String command,
java.lang.Object[] args)
Invokes a command on this widget.
|
private java.lang.String |
normalizeLocalPath(java.lang.String path,
boolean allowDirectory)
Convenient method to add file protocol prefix and do path clean-up before resolving to local file.
|
private boolean |
openUrl(java.lang.String urlString)
Open the specified URL.
|
void |
placeWidget(NativeRectangle bounds)
Place the driver-specific widget at the specified bounds, using the currently selected
window.
|
private void |
resetHandler()
This resets the handlers for this browser and should be called when the state of the
CONTEXT-PATH or RESOUCE-BASE is changed.
|
private void |
resolveHTMLHrefs(java.io.File inputHTML,
java.io.File outputHTML)
The HTML rendered on the Web client should have local hrefs resolved.
|
boolean |
setWidgetAttribute(java.lang.String attr,
java.lang.String val)
Set an attribute for a widget implemented at the driver level.
|
config, getWindow, setEnabled, setVisible, setWindow
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invokeWidgetCommand
private static final java.util.logging.Logger LOG
private org.eclipse.jetty.server.handler.ContextHandler handler
private java.lang.String currentContextPath
private java.net.URL currentResourceBase
public WebHtmlBrowser(int widgetId, GuiWebSocket websock)
widgetId
- The widget's ID.websock
- The web socket.public boolean setWidgetAttribute(java.lang.String attr, java.lang.String val)
This works only for GUI drivers.
attr
- The attribute name.val
- The attribute's value.true
if setting this attribute completed.public java.lang.Object invokeWidgetCommand(java.lang.String command, java.lang.Object[] args)
command
- The command to invoke.args
- Optional event arguments.public void placeWidget(NativeRectangle bounds)
placeWidget
in interface DriverWidget
placeWidget
in class WebDriverWidget
bounds
- Widget bounds.public void destroy()
destroy
in interface DriverWidget
destroy
in class WebDriverWidget
private boolean openUrl(java.lang.String urlString)
urlString
- The URL to open.true
.private java.lang.String normalizeLocalPath(java.lang.String path, boolean allowDirectory)
path
- The path to be locally resolved.allowDirectory
- This can also normalize local directory paths.null
if the path was invalid.private void resolveHTMLHrefs(java.io.File inputHTML, java.io.File outputHTML)
inputHTML
- The file which contains the input HTML.outputHTML
- The file in which we should dump a HTML with resolved hrefs.private java.lang.String generateContextPath()
private void resetHandler()