idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
127,200 | public static String [ ] getTokens ( String str , String delim , boolean trim ) { StringTokenizer stok = new StringTokenizer ( str , delim ) ; String tokens [ ] = new String [ stok . countTokens ( ) ] ; for ( int i = 0 ; i < tokens . length ; i ++ ) { tokens [ i ] = stok . nextToken ( ) ; if ( trim ) tokens [ i ] = tok... | Splits given string into tokens with delimiters specified . It uses StringTokenizer for tokenizing . |
127,201 | public static String ordinalize ( int number ) { int modulo = number % 100 ; if ( modulo >= 11 && modulo <= 13 ) return number + "th" ; switch ( number % 10 ) { case 1 : return number + "st" ; case 2 : return number + "nd" ; case 3 : return number + "rd" ; default : return number + "th" ; } } | Turns a non - negative number into an ordinal string used to denote the position in an ordered sequence such as 1st 2nd 3rd 4th |
127,202 | public static String getText ( ) { Transferable contents = clipboard ( ) . getContents ( null ) ; try { if ( contents != null && contents . isDataFlavorSupported ( DataFlavor . stringFlavor ) ) return ( String ) contents . getTransferData ( DataFlavor . stringFlavor ) ; else return null ; } catch ( UnsupportedFlavorExc... | returns the current text contents of clipboard . If clipboard has no text contents or has no content it returns null |
127,203 | public static void clear ( ) { clipboard ( ) . setContents ( new Transferable ( ) { public DataFlavor [ ] getTransferDataFlavors ( ) { return new DataFlavor [ 0 ] ; } public boolean isDataFlavorSupported ( DataFlavor flavor ) { return false ; } public Object getTransferData ( DataFlavor flavor ) throws UnsupportedFlavo... | clears contents of clipboard |
127,204 | public void set ( byte [ ] buff , int offset , int length ) { if ( offset < 0 ) throw new IndexOutOfBoundsException ( "ByteSequence index out of range: " + offset ) ; if ( length < 0 ) throw new IndexOutOfBoundsException ( "ByteSequence index out of range: " + length ) ; if ( offset > buff . length - length ) throw new... | replaces the internal byte buffer with the given byte array . |
127,205 | public static Class getClassingClass ( int offset ) { Class [ ] context = ClassContext . INSTANCE . getClassContext ( ) ; offset += 2 ; return context . length > offset ? context [ offset ] : null ; } | returns the calling class . |
127,206 | public static String [ ] split ( String fileName ) { int dot = fileName . lastIndexOf ( '.' ) ; if ( dot == - 1 ) return new String [ ] { fileName , null } ; else return new String [ ] { fileName . substring ( 0 , dot ) , fileName . substring ( dot + 1 ) } ; } | splits given fileName into name and extension . |
127,207 | public static String getName ( String fileName ) { int dot = fileName . lastIndexOf ( '.' ) ; return dot == - 1 ? fileName : fileName . substring ( 0 , dot ) ; } | Returns name of the file without extension |
127,208 | public static String getExtension ( String fileName ) { int dot = fileName . lastIndexOf ( '.' ) ; return dot == - 1 ? null : fileName . substring ( dot + 1 ) ; } | Returns extension of the file . Returns null if there is no extension |
127,209 | public static void mkdir ( File dir ) throws IOException { if ( ! dir . exists ( ) && ! dir . mkdir ( ) ) throw new IOException ( "couldn't create directory: " + dir ) ; } | create specified directory if doesn t exist . |
127,210 | public XSModel parseString ( String schema , String baseURI ) { return xsLoader . load ( new DOMInputImpl ( null , null , baseURI , schema , null ) ) ; } | Parse an XML Schema document from String specified |
127,211 | public String findPrefix ( String uri ) { if ( uri == null ) uri = "" ; String prefix = getPrefix ( uri ) ; if ( prefix == null ) { String defaultURI = getURI ( "" ) ; if ( defaultURI == null ) defaultURI = "" ; if ( Util . equals ( uri , defaultURI ) ) prefix = "" ; } return prefix ; } | Return one of the prefixes mapped to a Namespace URI . |
127,212 | public String declarePrefix ( String uri ) { String prefix = findPrefix ( uri ) ; if ( prefix == null ) { if ( uri . isEmpty ( ) ) prefix = "" ; else { prefix = suggested . getProperty ( uri , suggestPrefix ) ; if ( getURI ( prefix ) != null ) { if ( prefix . isEmpty ( ) ) prefix = "ns" ; int i = 1 ; String _prefix ; w... | generated a new prefix and binds it to given uri . |
127,213 | @ SuppressWarnings ( { "unchecked" , "ManualArrayToCollectionCopy" } ) public static < E , T extends E > Collection < E > addAll ( Collection < E > c , T ... array ) { for ( T obj : array ) c . add ( obj ) ; return c ; } | Adds objects in array to the given collection |
127,214 | @ SuppressWarnings ( "unchecked" ) public static < E , T extends E > Collection < E > removeAll ( Collection < E > c , T ... array ) { for ( T obj : array ) c . remove ( obj ) ; return c ; } | Removes objects in array to the given collection |
127,215 | public static < T > List < T > filter ( Collection < T > c , Filter < T > filter ) { if ( c . size ( ) == 0 ) return Collections . emptyList ( ) ; List < T > filteredList = new ArrayList < T > ( c . size ( ) ) ; for ( T element : c ) { if ( filter . select ( element ) ) filteredList . add ( element ) ; } return filtere... | Returns List with elements from given collections which are selected by specified filter |
127,216 | public String [ ] command ( ) throws IOException { List < String > cmd = new ArrayList < String > ( ) ; String executable = javaHome . getCanonicalPath ( ) + FileUtil . SEPARATOR + "bin" + FileUtil . SEPARATOR + "java" ; if ( OS . get ( ) . isWindows ( ) ) executable += ".exe" ; cmd . add ( executable ) ; String path =... | Returns command with all its arguments |
127,217 | public Process launch ( OutputStream output , OutputStream error ) throws IOException { Process process = Runtime . getRuntime ( ) . exec ( command ( ) , null , workingDir ) ; RuntimeUtil . redirectStreams ( process , output , error ) ; return process ; } | launches jvm with current configuration . |
127,218 | public static void setInitialFocus ( Window window , final Component comp ) { window . addWindowFocusListener ( new WindowAdapter ( ) { public void windowGainedFocus ( WindowEvent we ) { comp . requestFocusInWindow ( ) ; we . getWindow ( ) . removeWindowFocusListener ( this ) ; } } ) ; } | sets intial focus in window to the specified component |
127,219 | public static void doAction ( JTextField textField ) { String command = null ; if ( textField . getAction ( ) != null ) command = ( String ) textField . getAction ( ) . getValue ( Action . ACTION_COMMAND_KEY ) ; ActionEvent event = null ; for ( ActionListener listener : textField . getActionListeners ( ) ) { if ( event... | Programmatically perform action on textfield . This does the same thing as if the user had pressed enter key in textfield . |
127,220 | public static void setText ( JTextComponent textComp , String text ) { if ( text == null ) text = "" ; if ( textComp . getCaret ( ) instanceof DefaultCaret ) { DefaultCaret caret = ( DefaultCaret ) textComp . getCaret ( ) ; int updatePolicy = caret . getUpdatePolicy ( ) ; caret . setUpdatePolicy ( DefaultCaret . NEVER_... | sets text of textComp without moving its caret . |
127,221 | public boolean merge ( ResourceMetadata other ) { boolean modified = m_metrics . addAll ( other . m_metrics ) ; if ( ! modified ) { modified = ! m_attributes . equals ( other . m_attributes ) ; } m_attributes . putAll ( other . m_attributes ) ; return modified ; } | Merges the metrics and attributes from the given instance to the current instance . |
127,222 | protected Result check ( ) throws Exception { m_repository . select ( Context . DEFAULT_CONTEXT , new Resource ( "notreal" ) , Optional . of ( Timestamp . fromEpochMillis ( 0 ) ) , Optional . of ( Timestamp . fromEpochMillis ( 0 ) ) ) ; return Result . healthy ( ) ; } | Perform simple query ; Establishes only that we can go to the database without excepting . |
127,223 | public Set < String > getSourceNames ( ) { return Sets . newHashSet ( Iterables . transform ( getDatasources ( ) . values ( ) , new Function < Datasource , String > ( ) { public String apply ( Datasource input ) { return input . getSource ( ) ; } } ) ) ; } | Returns the set of unique source names ; The names of the underlying samples used as the source of aggregations . |
127,224 | public void breadthFirstSearch ( Context context , SearchResultVisitor visitor , Resource root ) { Queue < Resource > queue = Lists . newLinkedList ( ) ; queue . add ( root ) ; while ( ! queue . isEmpty ( ) ) { Resource r = queue . remove ( ) ; for ( SearchResults . Result result : m_searcher . search ( context , match... | Visits all nodes in the resource tree bellow the given resource using breadth - first search . |
127,225 | public void depthFirstSearch ( Context context , SearchResultVisitor visitor , Resource root ) { ArrayDeque < SearchResults . Result > stack = Queues . newArrayDeque ( ) ; boolean skipFirstVisit = true ; SearchResults initialResults = new SearchResults ( ) ; initialResults . addResult ( root , new ArrayList < String > ... | Visits all nodes in the resource tree bellow the given resource using depth - first search . |
127,226 | private Set < String > searchForIds ( Context context , TermQuery query , ConsistencyLevel readConsistency ) { Set < String > ids = Sets . newTreeSet ( ) ; BoundStatement bindStatement = m_searchStatement . bind ( ) ; bindStatement . setString ( Schema . C_TERMS_CONTEXT , context . getId ( ) ) ; bindStatement . setStri... | Returns the set of resource ids that match the given term query . |
127,227 | private Set < String > searchForIds ( Context context , BooleanQuery query , ConsistencyLevel readConsistency ) { Set < String > ids = Sets . newTreeSet ( ) ; for ( BooleanClause clause : query . getClauses ( ) ) { Set < String > subQueryIds ; Query subQuery = clause . getQuery ( ) ; if ( subQuery instanceof BooleanQue... | Returns the set of resource ids that match the given boolean query . |
127,228 | public List < String > splitIdIntoElements ( String id ) { Preconditions . checkNotNull ( id , "id argument" ) ; List < String > elements = Lists . newArrayList ( ) ; int startOfNextElement = 0 ; int numConsecutiveEscapeCharacters = 0 ; char [ ] idChars = id . toCharArray ( ) ; for ( int i = 0 ; i < idChars . length ; ... | Splits a resource id into a list of elements . |
127,229 | private static void maybeAddSanitizedElement ( final String element , final List < String > elements ) { String sanitizedElement = element . trim ( ) ; if ( sanitizedElement . length ( ) == 0 ) { return ; } sanitizedElement = MATCH_ESCAPED_COLON . matcher ( sanitizedElement ) . replaceAll ( ":" ) ; sanitizedElement = M... | Maybe adds to element to the list after being sanitized . |
127,230 | public String joinElementsToId ( List < String > elements ) { Preconditions . checkNotNull ( elements , "elements argument" ) ; StringBuilder sb = new StringBuilder ( ) ; for ( String el : elements ) { if ( el == null ) { continue ; } String trimmedEl = el . trim ( ) ; if ( trimmedEl . length ( ) < 1 ) { continue ; } t... | Joins a list of elements into a resource id escaping special characters if required . |
127,231 | private Double aggregate ( Datasource ds , Collection < Double > values ) { return ( ( values . size ( ) / m_intervalsPer ) > ds . getXff ( ) ) ? ds . getAggregationFuction ( ) . apply ( values ) : Double . NaN ; } | is within XFF otherwise return NaN . |
127,232 | private boolean inRange ( ) { if ( m_working == null || m_nextOut == null ) { return false ; } Timestamp rangeUpper = m_nextOut . getTimestamp ( ) ; Timestamp rangeLower = m_nextOut . getTimestamp ( ) . minus ( m_resolution ) ; return m_working . getTimestamp ( ) . lte ( rangeUpper ) && m_working . getTimestamp ( ) . g... | true if the working input Row is within the Range of the next output Row ; false otherwise |
127,233 | public Class < ? > getBody ( String message ) { final Set < IdentifierLine > identifierLines = this . definitions . keySet ( ) ; final IdentifierLine messageId = new IdentifierLine ( ) ; for ( IdentifierLine id : identifierLines ) { final Map < Integer , String > mapIds = id . getMapIds ( ) ; final Set < Integer > keys... | GETTERS AND SETTERS |
127,234 | public static ExpectedCondition < List < WebElement > > presenceOfNbElementsLocatedBy ( final By locator , final int nb ) { return new ExpectedCondition < List < WebElement > > ( ) { public List < WebElement > apply ( WebDriver driver ) { final List < WebElement > elements = driver . findElements ( locator ) ; return e... | An expectation for checking that nb elements that match the locator are present on the web page . |
127,235 | public static ExpectedCondition < List < WebElement > > visibilityOfNbElementsLocatedBy ( final By locator , final int nb ) { return new ExpectedCondition < List < WebElement > > ( ) { public List < WebElement > apply ( WebDriver driver ) { int nbElementIsDisplayed = 0 ; final List < WebElement > elements = driver . fi... | An expectation for checking that nb elements present on the web page that match the locator are visible . Visibility means that the elements are not only displayed but also have a height and width that is greater than 0 . |
127,236 | public static ExpectedCondition < Boolean > waitForLoad ( ) { return new ExpectedCondition < Boolean > ( ) { public Boolean apply ( WebDriver driver ) { return ( ( JavascriptExecutor ) driver ) . executeScript ( "return document.readyState" ) . equals ( "complete" ) ; } } ; } | Expects that the target page is completely loaded . |
127,237 | public static String format ( String templateMessage , Object ... args ) throws TechnicalException { if ( null != templateMessage && countWildcardsOccurrences ( templateMessage , "%s" ) == args . length ) { try { return String . format ( templateMessage , args ) ; } catch ( final Exception e ) { throw new TechnicalExce... | Format given message with provided arguments |
127,238 | public static String getMessage ( String key , String bundle ) { if ( ! messagesBundles . containsKey ( bundle ) ) { if ( Context . getLocale ( ) == null ) { messagesBundles . put ( bundle , ResourceBundle . getBundle ( "i18n/" + bundle , Locale . getDefault ( ) ) ) ; } else { messagesBundles . put ( bundle , ResourceB... | Gets a message by key using the resources bundle given in parameters . |
127,239 | private static int countWildcardsOccurrences ( String templateMessage , String occurrence ) { if ( templateMessage != null && occurrence != null ) { final Pattern pattern = Pattern . compile ( occurrence ) ; final Matcher matcher = pattern . matcher ( templateMessage ) ; int count = 0 ; while ( matcher . find ( ) ) { c... | Count the number of occurrences of a given wildcard . |
127,240 | public void writeFailedResult ( int line , String value ) { logger . debug ( "Write Failed result => line:{} value:{}" , line , value ) ; writeValue ( resultColumnName , line , value ) ; } | Writes a fail result |
127,241 | public void writeSuccessResult ( int line ) { logger . debug ( "Write Success result => line:{}" , line ) ; writeValue ( resultColumnName , line , Messages . getMessage ( Messages . SUCCESS_MESSAGE ) ) ; } | Writes a success result |
127,242 | public void writeWarningResult ( int line , String value ) { logger . debug ( "Write Warning result => line:{} value:{}" , line , value ) ; writeValue ( resultColumnName , line , value ) ; } | Writes a warning result |
127,243 | public void writeDataResult ( String column , int line , String value ) { logger . debug ( "Write Data result => column:{} line:{} value:{}" , column , line , value ) ; writeValue ( column , line , value ) ; } | Writes some data as result . |
127,244 | private void displayMessageAtTheBeginningOfMethod ( String methodName , List < GherkinStepCondition > conditions ) { logger . debug ( "{} with {} contition(s)" , methodName , conditions . size ( ) ) ; displayConditionsAtTheBeginningOfMethod ( conditions ) ; } | Display a message at the beginning of method . |
127,245 | public boolean checkConditions ( List < GherkinStepCondition > conditions ) { for ( GherkinStepCondition gherkinCondition : conditions ) { logger . debug ( "checkConditions {} in context is " , gherkinCondition . getActual ( ) , Context . getValue ( gherkinCondition . getActual ( ) ) ) ; if ( ! gherkinCondition . check... | Check all conditions . |
127,246 | @ Et ( "Je sauvegarde la valeur de cette API REST '(.*)' '(.*)' '(.*)' dans '(.*)' du contexte[\\.|\\?]" ) @ And ( "I save the value of REST API '(.*)' '(.*)' '(.*)' in '(.*)' context key[\\.|\\?]" ) public void saveValue ( String method , String pageKey , String uri , String targetKey , List < GherkinStepCondition > c... | Save result of REST API in memory if all expected parameters equals actual parameters in conditions . |
127,247 | @ Experimental ( name = "validActivationEmail" ) @ RetryOnFailure ( attempts = 3 , delay = 60 ) @ Et ( "Je valide le mail d'activation '(.*)'[\\.|\\?]" ) @ And ( "I valid activation email '(.*)'[\\.|\\?]" ) public void validActivationEmail ( String mailHost , String mailUser , String mailPassword , String senderMail , ... | Valid activation email . |
127,248 | @ Times ( { @ Time ( name = "AM" ) , @ Time ( name = "{pageKey}" ) } ) @ Lorsque ( "'(.*)' est ouvert[\\.|\\?]" ) @ Given ( "'(.*)' is opened[\\.|\\?]" ) public void openUrlIfDifferent ( @ TimeName ( "pageKey" ) String pageKey , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { g... | Open Url if different with conditions . |
127,249 | @ Et ( "Je retourne vers '(.*)'" ) @ And ( "I go back to '(.*)'" ) public void goToUrl ( String pageKey ) throws TechnicalException , FailureException { goToUrl ( pageKey , true ) ; } | Go to Url . |
127,250 | private void navigateTo ( String pageKey , String urlToOpen , String windowHandle ) { Context . addWindow ( pageKey , windowHandle ) ; Context . setMainWindow ( pageKey ) ; Context . getDriver ( ) . navigate ( ) . to ( urlToOpen ) ; } | navigateTo change url on the same window . |
127,251 | private void switchToWindow ( String key , String handleToKeep ) { Context . addWindow ( key , handleToKeep ) ; Context . setMainWindow ( key ) ; Context . getDriver ( ) . switchTo ( ) . window ( handleToKeep ) ; } | switchToWindow switch to an other Window . |
127,252 | protected void clickOn ( PageElement toClick , Object ... args ) throws TechnicalException , FailureException { displayMessageAtTheBeginningOfMethod ( "clickOn: %s in %s" , toClick . toString ( ) , toClick . getPage ( ) . getApplication ( ) ) ; try { Context . waitUntil ( ExpectedConditions . elementToBeClickable ( Uti... | Click on html element . |
127,253 | protected boolean checkInputText ( PageElement pageElement , String textOrKey ) throws FailureException , TechnicalException { WebElement inputText = null ; String value = getTextOrKey ( textOrKey ) ; try { inputText = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageEl... | Checks if input text contains expected value . |
127,254 | protected void expectText ( PageElement pageElement , String textOrKey ) throws FailureException , TechnicalException { WebElement element = null ; String value = getTextOrKey ( textOrKey ) ; try { element = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ) ) )... | Expects that an element contains expected value . |
127,255 | protected boolean checkMandatoryTextField ( PageElement pageElement ) throws FailureException { WebElement inputText = null ; try { inputText = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ) ) ) ; } catch ( final Exception e ) { new Result . Failure < > ( pa... | Checks mandatory text field . |
127,256 | protected void checkText ( PageElement pageElement , String textOrKey ) throws TechnicalException , FailureException { WebElement webElement = null ; String value = getTextOrKey ( textOrKey ) ; try { webElement = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ... | Checks if HTML text contains expected value . |
127,257 | protected void updateList ( PageElement pageElement , String textOrKey ) throws TechnicalException , FailureException { String value = getTextOrKey ( textOrKey ) ; try { setDropDownValue ( pageElement , value ) ; } catch ( final Exception e ) { new Result . Failure < > ( e . getMessage ( ) , Messages . format ( Message... | Update a html select with a text value . |
127,258 | protected void updateDateValidated ( PageElement pageElement , String dateType , String date ) throws TechnicalException , FailureException { logger . debug ( "updateDateValidated with elementName={}, dateType={} and date={}" , pageElement , dateType , date ) ; final DateFormat formatter = new SimpleDateFormat ( Consta... | Update a html input text value with a date . |
127,259 | protected void saveElementValue ( String field , String targetKey , Page page ) throws TechnicalException , FailureException { logger . debug ( "saveValueInStep: {} to {} in {}." , field , targetKey , page . getApplication ( ) ) ; String txt = "" ; try { final WebElement elem = Utilities . findElement ( page , field ) ... | Save value in memory . |
127,260 | protected boolean checkRadioList ( PageElement pageElement , String value ) throws FailureException { try { final List < WebElement > radioButtons = Context . waitUntil ( ExpectedConditions . presenceOfAllElementsLocatedBy ( Utilities . getLocator ( pageElement ) ) ) ; for ( final WebElement button : radioButtons ) { i... | Checks that given value is matching the selected radio list button . |
127,261 | protected void updateRadioList ( PageElement pageElement , String valueOrKey ) throws TechnicalException , FailureException { final String value = Context . getValue ( valueOrKey ) != null ? Context . getValue ( valueOrKey ) : valueOrKey ; try { final List < WebElement > radioButtons = Context . waitUntil ( ExpectedCon... | Update html radio button by text input . |
127,262 | protected void passOver ( PageElement element ) throws TechnicalException , FailureException { try { final String javascript = "var evObj = document.createEvent('MouseEvents');" + "evObj.initMouseEvent(\"mouseover\",true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);" + "arguments[0].dispatchEvent... | Passes over a specific page element triggering mouseover js event . |
127,263 | protected void selectCheckbox ( PageElement element , boolean checked , Object ... args ) throws TechnicalException , FailureException { try { final WebElement webElement = Context . waitUntil ( ExpectedConditions . elementToBeClickable ( Utilities . getLocator ( element , args ) ) ) ; if ( webElement . isSelected ( ) ... | Checks a checkbox type element . |
127,264 | protected void switchFrame ( PageElement element , Object ... args ) throws FailureException , TechnicalException { try { Context . waitUntil ( ExpectedConditions . frameToBeAvailableAndSwitchToIt ( Utilities . getLocator ( element , args ) ) ) ; } catch ( final Exception e ) { new Result . Failure < > ( element , Mess... | Switches to the given frame . |
127,265 | protected void uploadFile ( PageElement pageElement , String fileOrKey , Object ... args ) throws TechnicalException , FailureException { final String path = Context . getValue ( fileOrKey ) != null ? Context . getValue ( fileOrKey ) : System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER + Fil... | Updates a html file input with the path of the file to upload . |
127,266 | public static Map < String , Method > getAllCucumberMethods ( Class < ? > clazz ) { final Map < String , Method > result = new HashMap < > ( ) ; final CucumberOptions co = clazz . getAnnotation ( CucumberOptions . class ) ; final Set < Class < ? > > classes = getClasses ( co . glue ( ) ) ; classes . add ( BrowserSteps ... | Gets all Cucumber methods . |
127,267 | public static Cookie getAuthenticationCookie ( String domainUrl ) throws TechnicalException { if ( getInstance ( ) . authCookie == null ) { final String cookieStr = System . getProperty ( SESSION_COOKIE ) ; try { if ( cookieStr != null && ! "" . equals ( cookieStr ) ) { final int indexValue = cookieStr . indexOf ( '=' ... | Returns a Cookie object by retrieving data from - Dcookie maven parameter . |
127,268 | public static String usingAuthentication ( String url ) { if ( authenticationTypes . BASIC . toString ( ) . equals ( getInstance ( ) . authenticationType ) ) { return url . replace ( "://" , "://" + getLogin ( ) + ":" + getPassword ( ) + "@" ) ; } return url ; } | Process a given url using the current authentication mode . |
127,269 | public static WebElement isElementPresentAndGetFirstOne ( By element ) { final WebDriver webDriver = Context . getDriver ( ) ; webDriver . manage ( ) . timeouts ( ) . implicitlyWait ( DriverFactory . IMPLICIT_WAIT * 2 , TimeUnit . MICROSECONDS ) ; final List < WebElement > foundElements = webDriver . findElements ( ele... | Check if element present and get first one . |
127,270 | @ Lorsque ( "Je patiente '(.*)' secondes[\\.|\\?]" ) @ Then ( "I wait '(.*)' seconds[\\.|\\?]" ) public void wait ( int time , List < GherkinStepCondition > conditions ) throws InterruptedException { Thread . sleep ( ( long ) time * 1000 ) ; } | Waits a time in second . |
127,271 | @ Lorsque ( "Je patiente la disparition de '(.*)-(.*)' avec un timeout de '(.*)' secondes[\\.|\\?]" ) @ Then ( "I wait staleness of '(.*)-(.*)' with timeout of '(.*)' seconds[\\.|\\?]" ) public void waitStalenessOf ( String page , String element , int time , List < GherkinStepCondition > conditions ) throws TechnicalEx... | Waits staleness of element with timeout of x seconds . |
127,272 | @ Lorsque ( "Si '(.*)' vérifie '(.*)', je fais '(.*)' fois:")
@ Then ( "If '(.*)' matches '(.*)', I do '(.*)' times:" ) public void loop ( String actual , String expected , int times , List < GherkinConditionedLoopedStep > steps ) { try { if ( new GherkinStepCondition ( "loopKey" , expected , actual ) . checkConditio... | Loops on steps execution for a specific number of times . |
127,273 | @ Lorsque ( "Je vérifie les champs obligatoires:")
@ Given ( "I check mandatory fields:" ) public void checkMandatoryFields ( Map < String , String > mandatoryFields ) throws TechnicalException , FailureException { final List < String > errors = new ArrayList < > ( ) ; for ( final Entry < String , String > element : ... | Check all mandatory fields . |
127,274 | @ Et ( "Je sauvegarde la valeur de '(.*)-(.*)' dans la clé '(.*)' du contexte[\\.|\\?]")
@ And ( "I save the value of '(.*)-(.*)' in '(.*)' context key[\\.|\\?]" ) public void saveValue ( String page , String field , String targetKey , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureExce... | Save field in memory if all expected parameters equals actual parameters in conditions . The value is saved directly into the Context targetKey . |
127,275 | @ Quand ( "Je clique sur '(.*)-(.*)'[\\.|\\?]" ) @ When ( "I click on '(.*)-(.*)'[\\.|\\?]" ) public void clickOn ( String page , String toClick , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { logger . debug ( "{} clickOn: {}" , page , toClick ) ; clickOn ( Page . getInstance... | Click on html element if all expected parameters equals actual parameters in conditions . |
127,276 | @ Quand ( "Je clique via js sur xpath '(.*)' de '(.*)' page[\\.|\\?]" ) @ When ( "I click by js on xpath '(.*)' from '(.*)' page[\\.|\\?]" ) public void clickOnXpathByJs ( String xpath , String page , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { logger . debug ( "clickOnByJs... | Click on html element using Javascript if all expected parameters equals actual parameters in conditions . |
127,277 | @ Quand ( "Je passe au dessus de '(.*)-(.*)'[\\.|\\?]" ) @ When ( "I pass over '(.*)-(.*)'[\\.|\\?]" ) public void passOver ( String page , String elementName , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { passOver ( Page . getInstance ( page ) . getPageElementByKey ( '-' + ... | Simulates the mouse over a html element |
127,278 | @ Quand ( "Je mets à jour la date '(.*)-(.*)' avec une '(.*)' date '(.*)'[\\.|\\?]")
@ When ( "I update date '(.*)-(.*)' with a '(.*)' date '(.*)'[\\.|\\?]" ) public void updateDate ( String page , String elementName , String dateType , String dateOrKey , List < GherkinStepCondition > conditions ) throws TechnicalExc... | Update a html input text with a date . |
127,279 | @ Lorsque ( "Je vérifie le champ obligatoire '(.*)-(.*)' de type '(.*)'[\\.|\\?]")
@ Then ( "I check mandatory field '(.*)-(.*)' of type '(.*)'[\\.|\\?]" ) public void checkMandatoryField ( String page , String fieldName , String type , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureExc... | Checks that mandatory field is no empty with conditions . |
127,280 | @ Et ( "Je vérifie le texte '(.*)-(.*)' avec '(.*)'[\\.|\\?]")
@ And ( "I check text '(.*)-(.*)' with '(.*)'[\\.|\\?]" ) public void checkInputText ( String page , String elementName , String textOrKey , List < GherkinStepCondition > conditions ) throws FailureException , TechnicalException { if ( ! checkInputText ( ... | Checks if html input text contains expected value . |
127,281 | @ Et ( "Je vérifie que '(.*)-(.*)' est visible[\\.|\\?]")
@ And ( "I check that '(.*)-(.*)' is visible[\\.|\\?]" ) public void checkElementVisible ( String page , String elementName , List < GherkinStepCondition > conditions ) throws FailureException , TechnicalException { checkElementVisible ( Page . getInstance ( p... | Checks if an html element is visible . |
127,282 | @ Et ( "Je vérifie le message '(.*)' sur l'alerte")
@ And ( "I check message '(.*)' on alert" ) public void checkAlert ( String messageOrKey ) throws TechnicalException , FailureException { final String message = Context . getValue ( messageOrKey ) != null ? Context . getValue ( messageOrKey ) : messageOrKey ; final ... | Checks that a given page displays a html alert with a message . |
127,283 | @ Et ( "Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)'[\\.|\\?]")
@ And ( "I update radio list '(.*)-(.*)' with '(.*)'[\\.|\\?]" ) public void updateRadioList ( String page , String elementName , String valueOrKey , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { updat... | Updates the value of a html radio element with conditions . |
127,284 | public WebDriver getDriver ( ) { String driverName = Context . getBrowser ( ) ; driverName = driverName != null ? driverName : DEFAULT_DRIVER ; WebDriver driver = null ; if ( ! drivers . containsKey ( driverName ) ) { try { driver = generateWebDriver ( driverName ) ; } catch ( final TechnicalException e ) { logger . er... | Get selenium driver . Drivers are lazy loaded . |
127,285 | private WebDriver generateIEDriver ( ) throws TechnicalException { final String pathWebdriver = DriverFactory . getPath ( Driver . IE ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECU... | Generates an ie webdriver . Unable to use it with a proxy . Causes a crash . |
127,286 | private WebDriver generateGoogleChromeDriver ( ) throws TechnicalException { final String pathWebdriver = DriverFactory . getPath ( Driver . CHROME ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDR... | Generates a chrome webdriver . |
127,287 | private void setChromeOptions ( final DesiredCapabilities capabilities , ChromeOptions chromeOptions ) { final HashMap < String , Object > chromePrefs = new HashMap < > ( ) ; chromePrefs . put ( "download.default_directory" , System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER ) ; chromeOptio... | Sets the target browser binary path in chromeOptions if it exists in configuration . |
127,288 | private WebDriver generateFirefoxDriver ( ) throws TechnicalException { final String pathWebdriver = DriverFactory . getPath ( Driver . FIREFOX ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDRIVER... | Generates a firefox webdriver . |
127,289 | private WebDriver generateWebDriver ( String driverName ) throws TechnicalException { WebDriver driver ; if ( IE . equals ( driverName ) ) { driver = generateIEDriver ( ) ; } else if ( CHROME . equals ( driverName ) ) { driver = generateGoogleChromeDriver ( ) ; } else if ( FIREFOX . equals ( driverName ) ) { driver = g... | Generates a selenium webdriver following a name given in parameter . By default a chrome driver is generated . |
127,290 | private void setLoggingLevel ( DesiredCapabilities caps ) { final LoggingPreferences logPrefs = new LoggingPreferences ( ) ; logPrefs . enable ( LogType . BROWSER , Level . ALL ) ; logPrefs . enable ( LogType . CLIENT , Level . OFF ) ; logPrefs . enable ( LogType . DRIVER , Level . OFF ) ; logPrefs . enable ( LogType .... | Sets the logging level of the generated web driver . |
127,291 | public static String getPath ( Driver currentDriver ) { final OperatingSystem currentOperatingSystem = OperatingSystem . getCurrentOperatingSystem ( ) ; String format = "" ; if ( "webdriver.ie.driver" . equals ( currentDriver . driverName ) ) { format = Utilities . setProperty ( Context . getWebdriversProperties ( curr... | Get the path of the driver given in parameters . |
127,292 | public static String getUrlByPagekey ( String pageKey ) { if ( pageKey != null ) { for ( final Map . Entry < String , Application > application : getInstance ( ) . applications . entrySet ( ) ) { for ( final Map . Entry < String , String > urlPage : application . getValue ( ) . getUrlPages ( ) . entrySet ( ) ) { if ( p... | Get url name in a string by page key . |
127,293 | public static String getApplicationByPagekey ( String pageKey ) { if ( pageKey != null ) { for ( final Map . Entry < String , Application > application : getInstance ( ) . applications . entrySet ( ) ) { for ( final Map . Entry < String , String > urlPage : application . getValue ( ) . getUrlPages ( ) . entrySet ( ) ) ... | Get application name in a string by page key . |
127,294 | private boolean isApplicationFound ( String applicationName ) { boolean applicationFinded = false ; List < String > appList = application . get ( ) ; if ( ! appList . isEmpty ( ) ) { if ( appList . contains ( applicationName ) ) { applicationFinded = true ; } else { logger . info ( "Application [{}] do not exist. You m... | Is application found looking for if applicationName match with an existing application . |
127,295 | public void remove ( String applicationName , Class < ? > robotContext , boolean verbose ) { logger . info ( "Remove application named [{}]." , applicationName ) ; removeApplicationPages ( applicationName , robotContext , verbose ) ; removeApplicationSteps ( applicationName , robotContext , verbose ) ; removeApplicatio... | Remove target application to your robot . |
127,296 | private boolean applyChange ( boolean isChangeAvailable , Supplier < C > changeToApply ) { if ( isChangeAvailable ) { canMerge = false ; C change = changeToApply . get ( ) ; this . expectedChange = change ; performingAction . suspendWhile ( ( ) -> apply . accept ( change ) ) ; if ( this . expectedChange != null ) { thr... | Helper method for reducing code duplication |
127,297 | public List < Message > pollQueue ( ) { boolean success = false ; ProgressStatus pollQueueStatus = new ProgressStatus ( ProgressState . pollQueue , new BasicPollQueueInfo ( 0 , success ) ) ; final Object reportObject = progressReporter . reportStart ( pollQueueStatus ) ; ReceiveMessageRequest request = new ReceiveMessa... | Poll SQS queue for incoming messages filter them and return a list of SQS Messages . |
127,298 | public List < CloudTrailSource > parseMessage ( List < Message > sqsMessages ) { List < CloudTrailSource > sources = new ArrayList < > ( ) ; for ( Message sqsMessage : sqsMessages ) { boolean parseMessageSuccess = false ; ProgressStatus parseMessageStatus = new ProgressStatus ( ProgressState . parseMessage , new BasicP... | Given a list of raw SQS message parse each of them and return a list of CloudTrailSource . |
127,299 | public void deleteMessageFromQueue ( Message sqsMessage , ProgressStatus progressStatus ) { final Object reportObject = progressReporter . reportStart ( progressStatus ) ; boolean deleteMessageSuccess = false ; try { sqsClient . deleteMessage ( new DeleteMessageRequest ( config . getSqsUrl ( ) , sqsMessage . getReceipt... | Delete a message from the SQS queue that you specified in the configuration file . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.