Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.swtbot.swt.finder.widgets
Class SWTBotBrowser

    java.lang.Object
      org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot<T>
          org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl<Browser>
              org.eclipse.swtbot.swt.finder.widgets.SWTBotBrowser

    public class SWTBotBrowser

extends AbstractSWTBotControl<Browser>

This represents a `Browser` widget.

Author:
  Libor Zoubek <lzoubek [at] redhat [dot] com>

Field Summary

Fields inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
`description, display, log, widget`

Constructor Summary
`SWTBotBrowser(Browser browser)` Constructs an instance of this object with the given browser
`SWTBotBrowser(Browser browser, SelfDescribing description)` Constructs an instance of this object with the given browser

Method Summary
`void` | `back()` Navigate to the previous session history item.
`void` | `execute(String script)` Executes script in browser asynchronously
`void` | `forward()` Navigate to the next session history item.
`Credentials` | `getCredentials()` Gets credentials.
`String` | `getText()` Gets the text of this object's widget.
`String` | `getUrl()`
`boolean` | `isBackEnabled()`
`boolean` | `isForwardEnabled()`
`boolean` | `isPageLoaded()`
`void` | `refresh()` Refreshes browser
`void` | `setCredentials(Credentials credentials)` Sets credentials, which will be used when page requires authentication, if both username and password set to null authentication (if requested) will be canceled
`void` | `setCredentials(String username, String password)` Sets credentials, which will be used when page requires authentication, if both username and password set to null authentication (if requested) will be canceled
`void` | `setUrl(String url)` Loads given URI into browser, the page is loaded asynchronously (see `isPageLoaded()`)
`void` | `waitForPageLoaded()` Waits until browser loads page.

Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl
`absoluteLocation, click, moveMouseToWidget, rightClick`

Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
`assertEnabled, asyncExec, backgroundColor, click, click, clickXY, contextMenu, contextMenu, createEvent, createMouseEvent, createSelectionEvent, doubleClickXY, foregroundColor, getId, getToolTipText, hasStyle, isActive, isEnabled, isEnabledInternal, isVisible, keyboard, notify, notify, notify, pressShortcut, pressShortcut, pressShortcut, rightClick, rightClick, setFocus, sleep, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, toString, traverse, waitForEnabled`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SWTBotBrowser

    public SWTBotBrowser(Browser browser)

  Constructs an instance of this object with the given browser

  Parameters:
    `browser` - the widget.
  Throws:
    `WidgetNotFoundException` - if the widget is `null` or widget has been disposed.
  Since:
    2.0

### SWTBotBrowser

    public SWTBotBrowser(Browser browser,
                         SelfDescribing description)

  Constructs an instance of this object with the given browser

  Parameters:
    `browser` - the widget.
    `description` - the description of the widget, this will be reported by `AbstractSWTBot.toString()`
  Throws:
    `WidgetNotFoundException` - if the widget is `null` or widget has been disposed.
  Since:
    2.0

Method Detail

### setUrl

    public void setUrl(String url)

  Loads given URI into browser, the page is loaded asynchronously (see `isPageLoaded()`)

  Parameters:
    `url` -

### getUrl

    public String getUrl()

  Returns:
    the current URL or an empty String if there is no current URL

### getText

    public String getText()

  Description copied from class: `AbstractSWTBot`
  Gets the text of this object's widget.

  Overrides:
    `getText` in class `AbstractSWTBot<Browser>`
  Returns:
    the text on the widget.

### execute

    public void execute(String script)

  Executes script in browser asynchronously

  Parameters:
    `script` -

### isBackEnabled

    public boolean isBackEnabled()

  Returns:
    the receiver's back command enabled state

### isForwardEnabled

    public boolean isForwardEnabled()

  Returns:
    the receiver's forward command enabled state

### back

    public void back()

  Navigate to the previous session history item.

### forward

    public void forward()

  Navigate to the next session history item.

### refresh

    public void refresh()

  Refreshes browser

### isPageLoaded

    public boolean isPageLoaded()

  Returns:
    `true` by default or when page was completely loaded by browser after asynchronous page load invoked by `#goURL(String)` was finished, this method returns false only during page loading

### waitForPageLoaded

    public void waitForPageLoaded()

  Waits until browser loads page.

  Throws:
    `TimeoutException` - if page is not loaded after default timeout

### setCredentials

    public void setCredentials(String username,
                               String password)

  Sets credentials, which will be used when page requires authentication, if both username and password set to null authentication (if requested) will be canceled

  Note: Credentials are shared by all `SWTBotBrowser` instances.

  instances

  Parameters:
    `username` - the username
    `password` - the password

### setCredentials

    public void setCredentials(Credentials credentials)

  Sets credentials, which will be used when page requires authentication, if both username and password set to null authentication (if requested) will be canceled

  Note: Credentials are shared by all `SWTBotBrowser` instances.

  instances

  Parameters:
    `credentials` - the credentials with the username and password

### getCredentials

    public Credentials getCredentials()

  Gets credentials.

  Returns:
    the credentials containing the username and password.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD