idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
36,100
public void alertEquals ( double seconds , String expectedAlertText ) { try { double timeTook = popup ( seconds ) ; timeTook = popupEquals ( seconds - timeTook , expectedAlertText ) ; checkAlertEquals ( expectedAlertText , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkAlertEquals ( expectedAlertText , se...
Waits up to the provided wait time for an alert present on the page has content equal to the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,101
public void alertMatches ( double seconds , String expectedAlertPattern ) { try { double timeTook = popup ( seconds ) ; timeTook = popupMatches ( seconds - timeTook , expectedAlertPattern ) ; checkAlertMatches ( expectedAlertPattern , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkAlertMatches ( expectedA...
Waits up to the provided wait time for an alert present on the page has content matching the expected patten . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,102
public void confirmationPresent ( double seconds ) { try { double timeTook = popup ( seconds ) ; checkConfirmationPresent ( seconds , timeTook ) ; } catch ( TimeoutException e ) { checkConfirmationPresent ( seconds , seconds ) ; } }
Waits up to the provided wait time for a confirmation is present on the page . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,103
public void confirmationNotPresent ( double seconds ) { try { double timeTook = noPopup ( seconds ) ; checkConfirmationNotPresent ( seconds , timeTook ) ; } catch ( TimeoutException e ) { checkConfirmationNotPresent ( seconds , seconds ) ; } }
Waits up to the provided wait time for a confirmation is not present on the page . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,104
public void confirmationEquals ( double seconds , String expectedConfirmationText ) { try { double timeTook = popup ( seconds ) ; timeTook = popupEquals ( seconds - timeTook , expectedConfirmationText ) ; checkConfirmationEquals ( expectedConfirmationText , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkC...
Waits up to the provided wait time for a confirmation present on the page has content equal to the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,105
public void confirmationMatches ( double seconds , String expectedConfirmationPattern ) { try { double timeTook = popup ( seconds ) ; timeTook = popupMatches ( seconds - timeTook , expectedConfirmationPattern ) ; checkConfirmationMatches ( expectedConfirmationPattern , seconds , timeTook ) ; } catch ( TimeoutException ...
Waits up to the provided wait time for a confirmation present on the page has content matching the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,106
public void promptPresent ( double seconds ) { try { double timeTook = popup ( seconds ) ; checkPromptPresent ( seconds , timeTook ) ; } catch ( TimeoutException e ) { checkPromptPresent ( seconds , seconds ) ; } }
Waits up to the provided wait time for a prompt is present on the page . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,107
public void promptNotPresent ( double seconds ) { try { double timeTook = noPopup ( seconds ) ; checkPromptNotPresent ( seconds , timeTook ) ; } catch ( TimeoutException e ) { checkPromptNotPresent ( seconds , seconds ) ; } }
Waits up to the provided wait time for a prompt is not present on the page . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,108
public void promptEquals ( double seconds , String expectedPromptText ) { try { double timeTook = popup ( seconds ) ; timeTook = popupEquals ( seconds - timeTook , expectedPromptText ) ; checkPromptEquals ( expectedPromptText , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkPromptEquals ( expectedPromptTe...
Waits up to the provided wait time for a prompt present on the page has content equal to the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,109
public void promptMatches ( double seconds , String expectedPromptPattern ) { try { double timeTook = popup ( seconds ) ; timeTook = popupMatches ( seconds - timeTook , expectedPromptPattern ) ; checkPromptMatches ( expectedPromptPattern , seconds , timeTook ) ; } catch ( TimeoutException e ) { checkPromptMatches ( exp...
Waits up to the provided wait time for a prompt present on the page has content matching the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,110
public void cookieExists ( double seconds , String expectedCookieName ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; while ( ! app . is ( ) . cookiePresent ( expectedCookieName ) && System . currentTimeMillis ( ) < end ) ; double timeTook = Math . min ( ( seconds * 1000 ) - ( end - System . curr...
Waits up to the provided wait time for a cookie exists in the application with the provided cookieName . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,111
public void cookieNotExists ( double seconds , String unexpectedCookieName ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; while ( app . is ( ) . cookiePresent ( unexpectedCookieName ) && System . currentTimeMillis ( ) < end ) ; double timeTook = Math . min ( ( seconds * 1000 ) - ( end - System ....
Waits up to the provided wait time for a cookie doesn t exist in the application with the provided cookieName . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,112
public void cookieEquals ( double seconds , String cookieName , String expectedCookieValue ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; while ( app . is ( ) . cookiePresent ( cookieName ) && System . currentTimeMillis ( ) < end ) ; if ( app . is ( ) . cookiePresent ( cookieName ) ) { while ( !...
Waits up to the provided wait time for a cookies with the provided name has a value equal to the expected value . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,113
public void cookieMatches ( double seconds , String cookieName , String expectedCookiePattern ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; while ( app . is ( ) . cookiePresent ( cookieName ) && System . currentTimeMillis ( ) < end ) ; if ( app . is ( ) . cookiePresent ( cookieName ) ) { while ...
Waits up to the provided wait time for a cookies with the provided name has a value matching the expected pattern . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,114
public boolean present ( ) { boolean isPresent = false ; try { element . getWebElement ( ) . getText ( ) ; isPresent = true ; } catch ( NoSuchElementException | StaleElementReferenceException e ) { log . info ( e ) ; } return isPresent ; }
Determines whether the element is present or not .
36,115
public boolean input ( ) { boolean isInput = false ; try { WebElement webElement = element . getWebElement ( ) ; if ( "input" . equalsIgnoreCase ( webElement . getTagName ( ) ) || "textarea" . equalsIgnoreCase ( webElement . getTagName ( ) ) || SELECT . equalsIgnoreCase ( webElement . getTagName ( ) ) ) { isInput = tru...
Determines whether the element is an input or not . An input could be an input element a textarea or a select
36,116
public boolean select ( ) { boolean isSelect = false ; try { WebElement webElement = element . getWebElement ( ) ; if ( SELECT . equalsIgnoreCase ( webElement . getTagName ( ) ) ) { isSelect = true ; } } catch ( NoSuchElementException e ) { log . info ( e ) ; } return isSelect ; }
Determines whether the element is a select or not .
36,117
public boolean table ( ) { boolean isTable = false ; try { WebElement webElement = element . getWebElement ( ) ; if ( "table" . equalsIgnoreCase ( webElement . getTagName ( ) ) ) { isTable = true ; } } catch ( NoSuchElementException e ) { log . info ( e ) ; } return isTable ; }
Determines whether the element is a table or not .
36,118
public boolean enabled ( ) { boolean isEnabled = false ; try { isEnabled = ( element . getWebElement ( ) . isEnabled ( ) && ! element . get ( ) . allAttributes ( ) . containsKey ( "disabled" ) ) ; } catch ( NullPointerException | NoSuchElementException e ) { log . info ( e ) ; } return isEnabled ; }
Determines whether the element is enabled or not .
36,119
public boolean checked ( ) { boolean isChecked = false ; try { isChecked = element . getWebElement ( ) . isSelected ( ) ; } catch ( Exception e ) { log . info ( e ) ; } return isChecked ; }
Determines whether the element is checked or not .
36,120
public boolean displayed ( ) { boolean isDisplayed = false ; try { isDisplayed = element . getWebElement ( ) . isDisplayed ( ) ; } catch ( NoSuchElementException e ) { log . info ( e ) ; } return isDisplayed ; }
Determines whether the element is displayed or not .
36,121
public boolean somethingSelected ( ) { boolean isSelected = false ; if ( input ( ) ) { WebElement webElement = element . getWebElement ( ) ; if ( "input" . equalsIgnoreCase ( webElement . getTagName ( ) ) ) { isSelected = webElement . isSelected ( ) ; } else if ( SELECT . equalsIgnoreCase ( webElement . getTagName ( ) ...
Determines whether the element has something selected or not . Checkboxes radio buttons and selects could all have something selected . Other elements will default to false .
36,122
public void cssValue ( String attribute , String expectedValue ) { String cssValue = checkCssValue ( attribute , expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( cssValue == null && expectedValue != null && getElement ( ) . is ( ) . present ( ) ) { reason = "CSS attribute not found" ; } assertFalse ( r...
Asserts that the element has a css attribute with a value equal to the value provided . If the element isn t present or the css doesn t contain the desired attribute this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging su...
36,123
public void attribute ( String attribute , String expectedValue ) { String value = checkAttribute ( attribute , expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Attribute doesn't exist" ; } assertNotNull ( reason , value ) ; assertEqu...
Asserts that the element has an attribute with a value equals to the value provided . If the element isn t present or the element does not have the attribute this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,124
public void text ( String expectedText ) { String text = checkText ( expectedText , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , text ) ; assertEquals ( "Text Mismatch" , expectedText , text ) ; }
Asserts that the element s text equals the provided expected text . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,125
public void text ( int row , int col , String expectedText ) { String text = checkText ( row , col , expectedText , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( text == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not table" ; } assertNotNull ( reason , text ) ; assertEquals ( "Text Mismatch...
Asserts that the element s text in a particular cell equals the provided expected text . If the element isn t present or a table this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,126
public void value ( String expectedValue ) { String value = checkValue ( expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not input" ; } assertNotNull ( reason , value ) ; assertEquals ( "Value Mismatch" , expectedValue , valu...
Asserts that the element s value equals the provided expected value . If the element isn t present or an input this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,127
public void selectedOption ( String expectedText ) { String option = checkSelectedOption ( expectedText , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( option == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , option ) ; assertEquals ( "Selected Option Mism...
Asserts that the element s selected option equals the provided expected option . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,128
public void selectedValue ( String expectedValue ) { String value = checkSelectedValue ( expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , value ) ; assertEquals ( "Selected Value Mismatch...
Asserts that the element s selected value equals the provided expected value . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,129
public void selectOptions ( String ... expectedOptions ) { String [ ] options = checkSelectOptions ( expectedOptions , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( options == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , options ) ; assertEquals ( "Selec...
Asserts that the element s select options equal the provided expected options . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,130
public void selectValues ( String ... expectedValues ) { String [ ] values = checkSelectValues ( expectedValues , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( values == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , values ) ; assertEquals ( "Selected Val...
Asserts that the element s select values equal the provided expected values . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,131
public void text ( int row , int col , String text ) { text ( row , col , text , defaultWait ) ; }
Waits for the element s text in a particular cell equals the provided expected text . If the element isn t present or a table this will constitute a failure same as a mismatch . The default wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a ...
36,132
public void clazz ( String expectedClass , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; while ( ! ( expectedClass == null ? element . get ( ) . attribute ( CLASS ) == null : expectedClass . equals ( element . get ( ) . attribute ( CLASS ) ) ) &...
Waits for the element s class equals the provided expected class . If the element isn t present this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screenshot for traceability a...
36,133
public void attribute ( String attribute , String expectedValue , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; while ( ! expectedValue . equals ( element . get ( ) . attribute ( attribute ) ) && System . currentTimeMillis ( ) < end ) ; double t...
Waits for the element has an attribute with a value equals to the value provided . If the element isn t present or the element does not have the attribute this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will ...
36,134
public void text ( String expectedText , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { double timeTook = elementPresent ( seconds ) ; WebDriverWait wait = new WebDriverWait ( element . getDriver ( ) , ( long ) ( seconds - timeTook ) , DEFAULT_POLLING_INTERVAL ) ; wait . unt...
Waits for the element s text equals the provided expected text . If the element isn t present this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screenshot for traceability and...
36,135
public void text ( int row , int col , String expectedText , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; while ( ! element . get ( ) . tableCell ( row , col ) . get ( ) . text ( ) . equals ( expectedText ) && System . currentTimeMillis ( ) < e...
Waits for the element s text in a particular cell equals the provided expected text . If the element isn t present or a table this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a...
36,136
public void value ( String expectedValue , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { double timeTook = elementPresent ( seconds ) ; WebDriverWait wait = new WebDriverWait ( element . getDriver ( ) , ( long ) ( seconds - timeTook ) , DEFAULT_POLLING_INTERVAL ) ; wait . u...
Waits for the element s value equals the provided expected value . If the element isn t present or an input this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screenshot for tr...
36,137
public void selectedOption ( String expectedText , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; if ( ! element . is ( ) . select ( ) ) { throw new TimeoutException ( ELEMENT_NOT_SELECT ) ; } while ( ! element . get ( ) . selectedOption ( ) . eq...
Waits for the element s selected option equals the provided expected option . If the element isn t present or a select this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screen...
36,138
public void selectedValue ( String expectedValue , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; if ( ! element . is ( ) . select ( ) ) { throw new TimeoutException ( ELEMENT_NOT_SELECT ) ; } while ( ! element . get ( ) . selectedValue ( ) . equ...
Waits for the element s selected value equals the provided expected value . If the element isn t present or a select this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screensh...
36,139
public void selectOptions ( String [ ] expectedOptions , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; if ( ! element . is ( ) . select ( ) ) { throw new TimeoutException ( ELEMENT_NOT_SELECT ) ; } while ( ! Arrays . toString ( element . get ( )...
Waits for the element s select options equal the provided expected options . If the element isn t present or a select this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screens...
36,140
public void selectValues ( String [ ] expectedValues , double seconds ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; try { elementPresent ( seconds ) ; if ( ! element . is ( ) . select ( ) ) { throw new TimeoutException ( ELEMENT_NOT_SELECT ) ; } while ( ! Arrays . toString ( element . get ( ) ....
Waits for the element s select values equal the provided expected values . If the element isn t present or a select this will constitute a failure same as a mismatch . The provided wait time will be used and if the element doesn t have the desired match count at that time it will fail and log the issue with a screensho...
36,141
public static BrowserName lookup ( String b ) throws InvalidBrowserException { for ( BrowserName browser : BrowserName . values ( ) ) { if ( browser . name ( ) . equalsIgnoreCase ( b ) ) { return browser ; } } throw new InvalidBrowserException ( "The selected browser " + b + " is not an applicable choice" ) ; }
allows the browser selected to be passed in with a case insensitive name
36,142
public void text ( String expectedPattern ) { String text = checkText ( expectedPattern , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , text ) ; assertTrue ( "Text Mismatch: text of '" + text + DOES_NOT_MATCH_PATTERN + expectedPattern + "'" , text . matches ( expectedPattern ) ) ; }
Asserts that the element s text matches the regular expression pattern provided . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,143
public void text ( int row , int col , String pattern ) { String text = checkText ( row , col , pattern , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , text ) ; assertTrue ( "Text Mismatch: text of '" + text + DOES_NOT_MATCH_PATTERN + pattern + "'" , text . matches ( pattern ) ) ; }
Asserts that the element s pattern in a particular cell matches the regular expression pattern provided . If the element isn t present or a table this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,144
@ SuppressWarnings ( "squid:S2259" ) public void value ( String expectedPattern ) { String value = checkValue ( expectedPattern , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not input" ; } assertNotNull ( reason , value ) ; assertTrue ( ...
Asserts that the element s value matches the regular expression pattern provided . If the element isn t present or an input this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,145
@ SuppressWarnings ( "squid:S2259" ) public void selectedOption ( String expectedPattern ) { String selectedOption = checkSelectedOption ( expectedPattern , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( selectedOption == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull...
Asserts that the element s selected option matches the regular expression pattern provided . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,146
@ SuppressWarnings ( "squid:S2259" ) public void selectedValue ( String expectedPattern ) { String selectedValue = checkSelectedValue ( expectedPattern , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( selectedValue == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( r...
Asserts that the element s selected value matches the regular expression pattern provided . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,147
private boolean isPopupPresent ( ) { boolean isPresent = false ; try { driver . switchTo ( ) . alert ( ) ; isPresent = true ; } catch ( NoAlertPresentException e ) { log . info ( e ) ; } return isPresent ; }
Determines if any popup is present on the page
36,148
public boolean cookiePresent ( String expectedCookieName ) { boolean isCookiePresent = false ; try { if ( driver . manage ( ) . getCookieNamed ( expectedCookieName ) != null ) { isCookiePresent = true ; } return isCookiePresent ; } catch ( Exception e ) { log . error ( e ) ; return false ; } }
Determines if a cookie exists in the application with the provided cookieName .
36,149
public boolean textPresentInSource ( String expectedText ) { try { return driver . getPageSource ( ) . contains ( expectedText ) ; } catch ( Exception e ) { log . info ( e ) ; return false ; } }
Determines if the provides text is present in the current page source .
36,150
public void clazz ( String unexpectedClass ) { String clazz = checkClazz ( unexpectedClass , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , clazz ) ; assertFalse ( "Class Mismatch: class of '" + clazz + CONTAINS + unexpectedClass + "'" , clazz . contains ( unexpectedClass ) ) ; }
Asserts that the element s class does not contain the provided expected class . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,151
public void attribute ( String expectedAttribute ) { Set < String > attributes = checkAttribute ( expectedAttribute , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , attributes ) ; assertFalse ( "Attribute found: element attributes of '" + String . join ( "," , attributes ) + CONTAINS + expectedAttribute + "'" , attribute...
Asserts that the element does not contain the provided expected attribute . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,152
public void text ( String expectedText ) { String text = checkText ( expectedText , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , text ) ; assertFalse ( "Text found: element text of '" + text + CONTAINS + expectedText + "'" , text . contains ( expectedText ) ) ; }
Asserts that the element s text does not contain the provided expected text . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,153
@ SuppressWarnings ( "squid:S2259" ) public void value ( String expectedValue ) { String value = checkValue ( expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not input" ; } assertNotNull ( reason , value ) ; assertFalse ( "Va...
Asserts that the element s value does not contain the provided expected value . If the element isn t present or an input this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,154
public void selectValue ( String expectedValue ) { String [ ] values = checkSelectValue ( expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( values == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , values ) ; assertFalse ( "Value found: element ...
Asserts that the element s options do not contain the provided expected value . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,155
public void contains ( Map < String , Object > expectedPairs ) { assertTrue ( "Expected to find " + Reporter . formatKeyPair ( expectedPairs ) , checkContains ( expectedPairs ) ) ; }
Asserts the actual response json payload contains each of the pair values provided and writes that to the output file . If this fails the code will immediately exit and record the error .
36,156
public void contains ( JsonElement expectedJson ) { assertTrue ( "Expected to find " + GSON . toJson ( expectedJson ) , checkContains ( expectedJson ) ) ; }
Asserts the actual response json payload contains to the expected json element and writes that out to the output file . If this fails the code will immediately exit and record the error .
36,157
public Element newElement ( Locator type , String locator ) { return new Element ( driver , reporter , type , locator ) ; }
setups a new element which is located on the page
36,158
public void wait ( double seconds ) { String action = "Wait " + seconds + SECONDS ; String expected = WAITED + seconds + SECONDS ; try { Thread . sleep ( ( long ) ( seconds * 1000 ) ) ; } catch ( InterruptedException e ) { log . warn ( e ) ; reporter . fail ( action , expected , "Failed to wait " + seconds + SECONDS + ...
Pauses the test for a set amount of time
36,159
public void goToURL ( String url ) { String action = "Loading " + url ; String expected = "Loaded " + url ; double start = System . currentTimeMillis ( ) ; try { driver . get ( url ) ; } catch ( Exception e ) { log . warn ( e ) ; reporter . fail ( action , expected , "Fail to Load " + url + ". " + e . getMessage ( ) ) ...
Navigates to a new url
36,160
public void takeScreenshot ( String imageName ) { if ( browser . getName ( ) == BrowserName . HTMLUNIT ) { return ; } try { File srcFile ; if ( Property . isHubSet ( ) ) { WebDriver augemented = new Augmenter ( ) . augment ( driver ) ; srcFile = ( ( TakesScreenshot ) augemented ) . getScreenshotAs ( OutputType . FILE )...
Takes a full screenshot of the entire page
36,161
public void goBack ( ) { String action = "Going back one page" ; String expected = "Previous page from browser history is loaded" ; try { driver . navigate ( ) . back ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Browser was unable to go back one page. " + e . getMessage ( ) ) ; log . warn ( e ...
Go back one page in the current test s browser history
36,162
public void setCookie ( Cookie cookie ) { String domain = cookie . getDomain ( ) ; Date expiry = cookie . getExpiry ( ) ; String name = cookie . getName ( ) ; String path = cookie . getPath ( ) ; String value = cookie . getValue ( ) ; String action = "Setting up cookie with attributes:<div><table><tbody><tr><td>Domain<...
Adds a cookie to the application for this particular test
36,163
public void deleteCookie ( String cookieName ) { String action = "Deleting cookie <i>" + cookieName + "</i>" ; String expected = "Cookie <i>" + cookieName + "</i> is removed" ; try { Cookie cookie = driver . manage ( ) . getCookieNamed ( cookieName ) ; if ( cookie == null ) { reporter . fail ( action , expected , "Unab...
Deletes a stored cookie indicated by the cookieName for this particular test . If the cookie by the provided name isn t present than an error will be logged and recorded
36,164
public void deleteAllCookies ( ) { String action = "Deleting all cookies" ; String expected = "All cookies are removed" ; try { driver . manage ( ) . deleteAllCookies ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Unable to remove all cookies. " + e . getMessage ( ) ) ; log . warn ( e ) ; return...
Delete all stored cookies for this particular test
36,165
public void resize ( int width , int height ) { String action = "Resizing browser to " + width + " x " + height ; String expected = "Browser is resized to " + width + " x " + height ; try { Dimension dimension = new Dimension ( width , height ) ; driver . manage ( ) . window ( ) . setSize ( dimension ) ; } catch ( Exce...
Resizes the current window to the specified size
36,166
public void scroll ( int desiredPosition ) { String action = "Scrolling page by " + desiredPosition + " pixels" ; String expected = "Page is scrolled down " + desiredPosition + " pixels" ; Long newPosition ; try { JavascriptExecutor jse = ( JavascriptExecutor ) driver ; Long initialPosition = ( Long ) jse . executeScri...
An custom script to scroll to a given position on the page using javascript . If the browser being used doesn t support javascript or the page isn t long enough to support scrolling to the desired position than an error will be logged and recorded
36,167
public void openNewWindow ( String url ) { String action = "Opening new window to url " + url ; String expected = "New window is opened to url " + url ; try { JavascriptExecutor jse = ( JavascriptExecutor ) driver ; jse . executeScript ( "window.open('" + url + "','_blank');" ) ; } catch ( Exception e ) { reporter . fa...
Opens a new tab and have it selected . The page provided will be loaded
36,168
public void switchToNewWindow ( ) { String action = "Switching to the new window" ; String expected = "New window is available and selected" ; try { parentWindow = driver . getWindowHandle ( ) ; for ( String winHandle : driver . getWindowHandles ( ) ) { driver . switchTo ( ) . window ( winHandle ) ; } } catch ( Excepti...
Switches to the next window . This is an alternative to switchNextTab or switchPreviousTab as this works better for some systems and environments that others .
36,169
public void switchToParentWindow ( ) { String action = "Switching back to parent window" ; String expected = "Parent window is available and selected" ; try { driver . switchTo ( ) . window ( parentWindow ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Parent window was unable to be selected. " + e...
Switches to the originally opened window . This is an alternative to switchNextTab or switchPreviousTab as this works better for some systems and environments that others .
36,170
public void closeCurrentWindow ( ) { String action = "Closing currently selected window" ; String expected = "Current window is closed" ; try { driver . close ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Current window was unable to be closed. " + e . getMessage ( ) ) ; log . warn ( e ) ; retu...
Close the currently selected window . After this window is closed ensure that focus is shifted to the next window using switchToNewWindow or switchToParentWindow methods . This is an alternative to closeTab as this works better for some systems and environments that others .
36,171
public void selectMainWindow ( ) { String action = "Switching to main window" ; String expected = "Main window is selected" ; try { driver . switchTo ( ) . defaultContent ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Main window was not selected. " + e . getMessage ( ) ) ; log . warn ( e ) ; re...
Select the main window . Used for returning to the main content after selecting a frame . If there are nested frames the main content will be selected not the next frame in the parent child relationship
36,172
public void selectParentFrame ( ) { String action = "Switching to parent frame" ; String expected = "Parent frame is selected" ; try { driver . switchTo ( ) . parentFrame ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Parent frame was not selected. " + e . getMessage ( ) ) ; log . warn ( e ) ; r...
Select the parent frame . Used for returning to the next frame up after selecting a frame . If there are nested frames the main content won t be selected however the next frame in the parent child relationship will be
36,173
public void acceptCertificate ( ) { String action = "Clicking override link to accept ssl certificate" ; String result = "Override link clicked" ; if ( browser . getName ( ) == BrowserName . INTERNETEXPLORER || browser . getName ( ) == BrowserName . EDGE ) { Element overrideLink = newElement ( Locator . ID , "overridel...
Safari Edge and IE don t recognize the allowInsecureCert capability . As a result an alternative method is provided in order to manually accept the problematic certificate
36,174
private boolean isNotConfirmation ( String action , String expected ) { if ( ! is . confirmationPresent ( ) ) { waitFor . confirmationPresent ( ) ; } if ( ! is . confirmationPresent ( ) ) { reporter . fail ( action , expected , "Unable to click confirmation as it is not present" ) ; return true ; } return false ; }
Determines if a confirmation is present or not and can be interacted with . If it s not present an indication that the confirmation can t be clicked on is written to the log file
36,175
private boolean isNotPrompt ( String action , String expected , String perform ) { if ( ! is . promptPresent ( ) ) { waitFor . promptPresent ( ) ; } if ( ! is . promptPresent ( ) ) { reporter . fail ( action , expected , "Unable to " + perform + " prompt as it is not present" ) ; return true ; } return false ; }
Determines if a prompt is present or not and can be interacted with . If it s not present an indication that the confirmation can t be clicked on is written to the log file
36,176
public void typeIntoPrompt ( String text ) { String action = "Typing text '" + text + "' into prompt" ; String expected = "Prompt is present and enabled to have text " + text + " typed in" ; if ( isNotPrompt ( action , expected , "type into" ) ) { return ; } try { Alert alert = driver . switchTo ( ) . alert ( ) ; alert...
Type text into a prompt box
36,177
public void titleMatches ( String expectedTitlePattern ) { String title = checkTitleMatches ( expectedTitlePattern , 0 , 0 ) ; assertTrue ( "Title Mismatch: title of '" + title + DOES_NOT_MATCH_PATTERN + expectedTitlePattern + "'" , title . matches ( expectedTitlePattern ) ) ; }
Verifies the provided title matches the actual title of the current page the application is on . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,178
public void alertMatches ( String expectedAlertPattern ) { String alert = checkAlertMatches ( expectedAlertPattern , 0 , 0 ) ; assertTrue ( "Alert Text Mismatch: alert text of '" + alert + DOES_NOT_MATCH_PATTERN + expectedAlertPattern + "'" , alert . matches ( expectedAlertPattern ) ) ; }
Asserts that an alert present on the page has content matching the expected patten . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,179
public void confirmationMatches ( String expectedConfirmationPattern ) { String confirmation = checkConfirmationMatches ( expectedConfirmationPattern , 0 , 0 ) ; assertTrue ( "Confirmation Text Mismatch: confirmation text of '" + confirmation + DOES_NOT_MATCH_PATTERN + expectedConfirmationPattern + "'" , confirmation ....
Asserts that a confirmation present on the page has content matching the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,180
public void promptMatches ( String expectedPromptPattern ) { String prompt = checkPromptMatches ( expectedPromptPattern , 0 , 0 ) ; assertTrue ( "Prompt Text Mismatch: prompt text of '" + prompt + DOES_NOT_MATCH_PATTERN + expectedPromptPattern + "'" , prompt . matches ( expectedPromptPattern ) ) ; }
Asserts that a prompt present on the page has content matching the expected text . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,181
public void cookieEquals ( String cookieName , String expectedCookieValue ) { assertEquals ( "Cookie Value Mismatch" , expectedCookieValue , checkCookieEquals ( cookieName , expectedCookieValue , 0 , 0 ) ) ; }
Asserts that a cookies with the provided name has a value equal to the expected value . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,182
public void cookieMatches ( String cookieName , String expectedCookiePattern ) { String cookie = checkCookieMatches ( cookieName , expectedCookiePattern , 0 , 0 ) ; assertTrue ( "Cookie Value Mismatch: cookie value of '" + cookie + DOES_NOT_MATCH_PATTERN + expectedCookiePattern + "'" , cookie . matches ( expectedCookie...
Asserts that a cookies with the provided name has a value matching the expected pattern . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,183
public void clazz ( String expectedClass ) { String clazz = checkClazz ( expectedClass , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , clazz ) ; assertTrue ( "Class Mismatch: class of '" + clazz + DOES_NOT_CONTAIN + expectedClass + "'" , clazz . contains ( expectedClass ) ) ; }
Asserts that the element s class contains the provided expected class . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,184
public void attribute ( String expectedAttribute ) { Set < String > attributes = checkAttribute ( expectedAttribute , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , attributes ) ; assertTrue ( "Attribute not found: element attributes of '" + String . join ( "," , attributes ) + DOES_NOT_CONTAIN + expectedAttribute + "'" ...
Asserts that the element contains the provided expected attribute . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,185
public void text ( String expectedText ) { String text = checkText ( expectedText , 0 , 0 ) ; assertNotNull ( NO_ELEMENT_FOUND , text ) ; assertTrue ( "Text not found: element text of '" + text + DOES_NOT_CONTAIN + expectedText + "'" , text . contains ( expectedText ) ) ; }
Asserts that the element s text contains the provided expected text . If the element isn t present this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,186
@ SuppressWarnings ( "squid:S2259" ) public void value ( String expectedValue ) { String value = checkValue ( expectedValue , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( value == null && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not input" ; } assertNotNull ( reason , value ) ; assertTrue ( "Val...
Asserts that the element s value contains the provided expected value . If the element isn t present or an input this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,187
public void selectOption ( String expectedOption ) { String [ ] options = checkSelectOption ( expectedOption , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( options == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , options ) ; assertTrue ( "Option not foun...
Asserts that the element s options contains the provided expected option . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,188
public void selectOptions ( int numOfOptions ) { int options = checkSelectOptions ( numOfOptions , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( options < 0 && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertTrue ( reason , options >= 0 ) ; assertEquals ( "Number of options mismatch"...
Asserts that the element has the expected number of options . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,189
public void columns ( int numOfColumns ) { int columns = checkColumns ( numOfColumns , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( columns < 0 && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not table" ; } assertTrue ( reason , columns >= 0 ) ; assertEquals ( "Number of columns mismatch" , numOfCol...
Asserts that the element has the expected number of columns . If the element isn t present or a table this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,190
public void rows ( int numOfRows ) { int rows = checkRows ( numOfRows , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( rows < 0 && getElement ( ) . is ( ) . present ( ) ) { reason = "Element not table" ; } assertTrue ( reason , rows >= 0 ) ; assertEquals ( "Number of rows mismatch" , numOfRows , rows ) ; }
Asserts that the element has the expected number of rows . If the element isn t present or a table this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .
36,191
private void recordResult ( ITestResult result ) { Reporter reporter = ( Reporter ) result . getAttribute ( REPORTER ) ; String htmlFilename = "" ; String pdfFilename = "" ; if ( reporter != null ) { reporter . finalizeReporter ( result . getStatus ( ) - 1 ) ; htmlFilename = reporter . getFileName ( ) + ".html" ; if ( ...
Checks to see if the test execution was performed on SauceLabs or not . If it was this reaches out to Sauce in order to update the execution results
36,192
@ SuppressWarnings ( "unchecked" ) protected < T > List < T > getDialogListeners ( Class < T > listenerInterface ) { final Fragment targetFragment = getTargetFragment ( ) ; List < T > listeners = new ArrayList < T > ( 2 ) ; if ( targetFragment != null && listenerInterface . isAssignableFrom ( targetFragment . getClass ...
Utility method for acquiring all listeners of some type for current instance of DialogFragment
36,193
private void modifyButtonsBasedOnScrollableContent ( boolean scrollable ) { if ( getView ( ) == null ) { return ; } View vButtonDivider = getView ( ) . findViewById ( R . id . sdl_button_divider ) ; View vButtonsBottomSpace = getView ( ) . findViewById ( R . id . sdl_buttons_bottom_space ) ; View vDefaultButtons = getV...
Button divider should be shown only if the content is scrollable .
36,194
private int resolveTheme ( ) { int theme = getTheme ( ) ; if ( theme != 0 ) { return theme ; } boolean useLightTheme = isActivityThemeLight ( ) ; Bundle args = getArguments ( ) ; if ( args != null ) { if ( args . getBoolean ( BaseDialogBuilder . ARG_USE_DARK_THEME ) ) { useLightTheme = false ; } else if ( args . getBoo...
Resolves the theme to be used for the dialog .
36,195
private boolean isActivityThemeLight ( ) { try { TypedValue val = new TypedValue ( ) ; getActivity ( ) . getTheme ( ) . resolveAttribute ( R . attr . isLightTheme , val , true ) ; TypedArray styledAttributes = getActivity ( ) . obtainStyledAttributes ( val . data , new int [ ] { R . attr . isLightTheme } ) ; boolean li...
This method resolves the current theme declared in the manifest
36,196
public Long processIdentifier ( Object id ) { Objects . requireNonNull ( id , "Element identifier cannot be null" ) ; if ( id instanceof Long ) return ( Long ) id ; if ( id instanceof Number ) return ( ( Number ) id ) . longValue ( ) ; if ( id instanceof String ) return Long . valueOf ( ( String ) id ) ; throw new Ille...
Process the given identifier converting it to the correct type if necessary .
36,197
public String matchPredicateOperand ( String alias ) { Objects . requireNonNull ( alias , "alias cannot be null" ) ; return alias + "." + idFieldName ; }
Gets the MATCH WHERE predicate operand .
36,198
public void createIndex ( String label , String propertyName ) { Objects . requireNonNull ( label , "label cannot be null" ) ; Objects . requireNonNull ( propertyName , "propertyName cannot be null" ) ; Neo4JSession session = currentSession ( ) ; transaction . readWrite ( ) ; session . executeStatement ( new Statement ...
Creates an index in the neo4j database .
36,199
private int getIndex ( int ind ) { int i = Arrays . binarySearchGreater ( index , ind , 0 , used ) ; if ( i < used && index [ i ] == ind ) return i ; int [ ] newIndex = index ; double [ ] newData = data ; if ( ++ used > data . length ) { int newLength = data . length != 0 ? data . length << 1 : 1 ; newLength = Math . m...
Tries to find the index . If it is not found a reallocation is done and a new index is returned .