Package de.frankmuenster.mahoe.web
Class AbstractSeleniumWebSite<I extends WebAccountInformation,M extends AbstractBankMessages<org.openqa.selenium.WebDriver>>
- java.lang.Object
-
- de.frankmuenster.mahoe.web.AbstractWebSite<org.openqa.selenium.WebDriver,I,M>
-
- de.frankmuenster.mahoe.web.AbstractSeleniumWebSite<I,M>
-
- Type Parameters:
I
- the concrete WebAccountInformationM
- the concrete AbstractBankMessages
- All Implemented Interfaces:
WebSite<I>
- Direct Known Subclasses:
BosWebSite
,SantanderWebSite
,TargoBankWebSite
public abstract class AbstractSeleniumWebSite<I extends WebAccountInformation,M extends AbstractBankMessages<org.openqa.selenium.WebDriver>> extends AbstractWebSite<org.openqa.selenium.WebDriver,I,M>
Abstract class for Selenium based WebSite to provide the driver and a temp download folder.- Since:
- 2.0
- Author:
- Frank Münster
-
-
Field Summary
-
Fields inherited from class de.frankmuenster.mahoe.web.AbstractWebSite
accountInfo, NON_BREAK_SPACE, TABLE_TAG, webClient
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSeleniumWebSite(de.willuhn.jameica.hbci.rmi.Konto konto)
Standardkonstruktor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkSeleniumDriverSet(org.openqa.selenium.WebDriver driver)
Checks if the driver is set and active. if not a status bar message is send that driver is not configured.protected boolean
elementExits(org.openqa.selenium.By byId)
checks if an element identified byBy
exitsstatic byte[]
getAccountSheetAsByteArray(org.apache.commons.lang3.tuple.Pair<java.util.Date,org.openqa.selenium.WebElement> document, org.openqa.selenium.WebDriver webClient)
Returns the account sheet as byte array.static java.nio.file.Path
getDownloadsDirectory()
Returns the temporary folder to use for downloading account sheets.protected org.openqa.selenium.WebDriver
getWebClient()
Here we setup the Selenium driver as replacement for the HTMLUnit client.void
saveCookies(java.lang.String backupFileName)
Save the cookies to be used next timestatic void
shutDown()
Clean and remove temp-folder and shutdown the driver-
Methods inherited from class de.frankmuenster.mahoe.web.AbstractWebSite
getGenericClassParameter, getMessages, getStartdate, setAccountBasicInfo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.frankmuenster.mahoe.web.WebSite
createSepaTransfer, getAccountInformation, getAccountSheets, getBookedTransactions, getPreBookedTransactions, isStillLoggedIn, login, logoff
-
-
-
-
Constructor Detail
-
AbstractSeleniumWebSite
protected AbstractSeleniumWebSite(de.willuhn.jameica.hbci.rmi.Konto konto) throws WebSiteException
Standardkonstruktor- Parameters:
konto
-- Throws:
WebSiteException
-
-
Method Detail
-
getAccountSheetAsByteArray
public static byte[] getAccountSheetAsByteArray(org.apache.commons.lang3.tuple.Pair<java.util.Date,org.openqa.selenium.WebElement> document, org.openqa.selenium.WebDriver webClient) throws WebSiteException
Returns the account sheet as byte array. The link must be loadable ithout any additional waitings,- Parameters:
document
- the message from the postbox with download link insidewebClient
-- Returns:
- the account sheet as byte array
- Throws:
WebSiteException
- if the download of the account sheet failed
-
getDownloadsDirectory
public static java.nio.file.Path getDownloadsDirectory() throws de.willuhn.util.ApplicationException
Returns the temporary folder to use for downloading account sheets. Create a new one per session.- Returns:
- the tmp folder to use during this session
- Throws:
de.willuhn.util.ApplicationException
- if the tmp folder cannot be created
-
shutDown
public static void shutDown()
Clean and remove temp-folder and shutdown the driver
-
saveCookies
public void saveCookies(java.lang.String backupFileName)
Save the cookies to be used next time
-
checkSeleniumDriverSet
protected void checkSeleniumDriverSet(org.openqa.selenium.WebDriver driver) throws WebSiteException
Checks if the driver is set and active. if not a status bar message is send that driver is not configured.- Parameters:
driver
- the driver to check- Throws:
WebSiteException
- when the driver is not set
-
elementExits
protected boolean elementExits(org.openqa.selenium.By byId)
checks if an element identified byBy
exits- Parameters:
byId
- the element to search for- Returns:
- truer in case the element exists, false else
-
getWebClient
protected org.openqa.selenium.WebDriver getWebClient()
Here we setup the Selenium driver as replacement for the HTMLUnit client.- Specified by:
getWebClient
in classAbstractWebSite<org.openqa.selenium.WebDriver,I extends WebAccountInformation,M extends AbstractBankMessages<org.openqa.selenium.WebDriver>>
- Returns:
- den WebClient
-
-