public class App extends Object
Constructor and Description |
---|
App(Browser browser,
org.openqa.selenium.remote.DesiredCapabilities capabilities,
OutputFile file)
Sets up the app object.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptAlert()
Accept (click 'OK' on) an alert box
|
void |
acceptConfirmation()
Accept (click 'OK' on) a confirmation box
|
void |
acceptPrompt()
Accept (click 'OK' on) a prompt box
|
Assert |
azzert()
Will handle all verifications performed on the actual application itself.
|
void |
closeCurrentWindow()
Close the currently selected window.
|
void |
closeTab()
Closes the current tab.
|
void |
deleteAllCookies()
Delete all stored cookies for this particular test
|
void |
deleteCookie(String cookieName)
Deletes a stored cookie, indicated by the cookieName for this particular
test.
|
void |
dismissConfirmation()
Dismiss (click 'Cancel' on) a confirmation box
|
void |
dismissPrompt()
Dismiss (click 'Cancel' on) a prompt box
|
Get |
get()
Retrieves information about the app in general, not specific to any
particular page or element.
|
Browser |
getBrowser()
Retrieves the browser being used for this particular test
|
org.openqa.selenium.remote.DesiredCapabilities |
getCapabilities()
Retrieves the browser (and potentially device) capabilities setup for
this particular test
|
org.openqa.selenium.WebDriver |
getDriver()
Retrieves the Selenium driver instance
|
OutputFile |
getOutputFile()
Retrieves the output file responsible for logging all actions and
assertions associated with this particular test
|
void |
goBack()
Go back one page in the current test's browser history
|
void |
goForward()
Go forward one page in the current test's browser history
|
void |
goToURL(String url)
Navigates to a new url
|
Is |
is()
Checks information about the app in general, not specific to any
particular page or element.
|
void |
killDriver()
Ends the current Selenium driver instance, which will end the test.
|
void |
maximize()
Maximizes the current window
|
Element |
newElement(Locator type,
String locator)
setups a new element which is located on the page
|
Element |
newElement(Locator type,
String locator,
int match)
setups a new element which is located on the page
|
boolean |
openTab()
Opens a new tab, and have it selected.
|
void |
openTab(String url)
Opens a new tab, and have it selected.
|
void |
refresh()
Reloads the current page
|
void |
refreshHard()
Reloads the current page while clearing the cache.
|
void |
scroll(int desiredPosition)
An custom script to scroll to a given position on the page, using
javascript.
|
void |
selectFrame(int frameNumber)
Select a frame by its (zero-based) index.
|
void |
selectFrame(String frameIdentifier)
Select a frame by its name or ID.
|
void |
setCookie(org.openqa.selenium.Cookie cookie)
Adds a cookie to the application for this particular test
|
void |
switchNextTab()
Switches to the next available tab.
|
void |
switchPreviousTab()
Switch to the previous available tab.
|
void |
switchToNewWindow()
Switches to the next window.
|
void |
switchToParentWindow()
Switches to the originally opened window.
|
void |
takeScreenshot(String imageName)
Takes a full screenshot of the entire page
|
void |
typeIntoPrompt(String text)
Type text into a prompt box
|
void |
wait(double seconds)
Pauses the test for a set amount of time
|
WaitFor |
waitFor()
Performs dynamic waits on the app in general, until a particular
condition of the application is met, not one for a particular page or
element.
|
public App(Browser browser, org.openqa.selenium.remote.DesiredCapabilities capabilities, OutputFile file) throws InvalidBrowserException, MalformedURLException
browser
- - the Browser we are running the test oncapabilities
- - what browser capabilities are desiredfile
- - the TestOutput file. This is provided by the
SeleniumTestBase functionalityInvalidBrowserException
- If a browser that is not one specified in the
Selenium.Browser class is used, this exception will be thrownMalformedURLException
- If the provided hub address isn't a URL, this exception will
be thrownpublic Element newElement(Locator type, String locator)
type
- - the locator type e.g. Locator.id, Locator.xpathlocator
- - the locator string e.g. login, //input[@id='login']public Element newElement(Locator type, String locator, int match)
type
- - the locator type e.g. Locator.id, Locator.xpathlocator
- - the locator string e.g. login, //input[@id='login']match
- - if there are multiple matches of the selector, this is which
match (starting at 0) to interact withpublic Is is()
public WaitFor waitFor()
public Get get()
public Assert azzert()
public org.openqa.selenium.WebDriver getDriver()
public Browser getBrowser()
public OutputFile getOutputFile()
public org.openqa.selenium.remote.DesiredCapabilities getCapabilities()
public void killDriver()
public void wait(double seconds)
seconds
- - the number of seconds to waitpublic void goToURL(String url)
url
- - the URL to navigate topublic void takeScreenshot(String imageName)
imageName
- - the name of the image typically generated via functions from
TestOutput.generateImageNamepublic boolean openTab()
public void openTab(String url)
url
- - the url to load once the new tab is opened and selectedpublic void switchNextTab()
public void switchPreviousTab()
public void closeTab()
public void goBack()
public void goForward()
public void refresh()
public void refreshHard()
public void setCookie(org.openqa.selenium.Cookie cookie)
cookie
- - the details of the cookie to setpublic void deleteCookie(String cookieName)
cookieName
- - the name of the cookie to deletepublic void deleteAllCookies()
public void maximize()
public void scroll(int desiredPosition)
desiredPosition
- - the position on the page to scroll topublic void switchToNewWindow()
public void switchToParentWindow()
public void closeCurrentWindow()
public void selectFrame(int frameNumber)
frameNumber
- - the frame number, starts at 0public void selectFrame(String frameIdentifier)
frameIdentifier
- - the frame name or IDpublic void acceptAlert()
public void acceptConfirmation()
public void dismissConfirmation()
public void acceptPrompt()
public void dismissPrompt()
public void typeIntoPrompt(String text)
text
- - the text to type into the promptCopyright © 2017. All rights reserved.