ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class WebBrowser.WebBrowser(system, config, b_type=None)

Define an abstract class that provides a common interface to all web browsers the User knows how to use. At load time an appropriate concrete implemention can be selected and used.

Parameters:

  • system: a <no title> object which lets us control the remote system

  • config: a <no title> object defining the current user

  • b_type: optionally a web browser type which can be passed to the WebBrowserImpl factory to get a suitable implementer object back

Find a link on the page with the given text and click on it.

This may require scrolling the screen to find the link.

This method will not return until the new page is done loading or it has been deteremined that the link cannot be found.

Parameters:

  • text: a string that is the text of the link to click

This will find any link that is currently visisble (without scrolling, and without defined behavior for links that are only half visible), then choose one at random and click on it.

Return: True if a link was clicked, False otherwise

Click a link which will start a download, then save it to the given path.

Parameters:

  • link: the string link text to click to start the download

  • path: the local path to save the file

download_uri(uri, path)

Enter a given URI which will start a download, then save it to the given path.

Parameters:

  • uri: the string URI to enter to start the download

  • path: the local path to save the file

go_back()

Press the Back button, or some sequence that accomplished the same goal (e.g., pressing backspace will often do it too).

go_forward()

Press the Forward button, or some sequence that accomplished the same goal

go_to_uri(uri)

Navigate to the URI, bringing this window to the fore before trying.

This method will block until the page is finished loading.

Parameters:

  • uri: a string to be typed into the URL bar of the browser

Return: True iff there are links on the page that could be clicked

helper(name, *args)

Invoke a helper on this instance.

Parameters:

  • name: the Name/ID of the <no title>

  • *args: any args taht should be passed to that helper

is_loaded()

Return True iff the page is loaded, False otherwise.

read()

“Read” the current page, which may include scrolling the page.

reload()

Reload the current page.