All Downloads are FREE. Search and download functionalities are using the official Maven repository.

okw.gui.OKWLocatorXPath Maven / Gradle / Ivy

Go to download

This is the core-module of OpenKeyWord. This module is automatically integrated by the adapters. In GUI automation, the core module is automatically integrated by the GUI modules (dependencies).

There is a newer version: 0.2.44
Show newest version
package okw.gui;

import okw.fourTestLocator;

public class OKWLocatorXPath extends OKWLocator
{
 
    public OKWLocatorXPath( )
    {
        super(  ) ;
    }
    
    public OKWLocatorXPath( String fpsLocator, OKWLocatorBase... fpLocators )
    {
        super( fpsLocator, fpLocators ) ;
    }
    

    /** 
     * \~german
     *  Konstruktor der Klasse. iframeID wird auf den Wert "" (empty string) gesetzt.
     *  
     *  @note
     *   fpsLocator = "//div[@ID='myID']" -> "//div[@ID='myID']"
     *   fpsLocator = "4T!MyValue" -> "//*[@data-4Test='MyValue']"
     *   fpsLocator = "4TNA!MyValue" -> "//*[contains( @name, 'MyValue']"
     *   fpsLocator = "4TID!MyValue" -> "//*[contains( @ID, 'MyValue']"
     *   fpsLocator = "4TLA!MyValue" -> "//label[contains(text(),'MyValue')]/following-sibling::input"
     *   fpsLocator = "4TTX!MyValue" -> "//*[contains(text(),'MyValue')]"
     *  
     *  @param Locator definiert die Objekterkennungseigenschaft des Objektes. Dieser wird als XPATH angegeben
     *  @param Locators Locatoren z.B. von Elternobjekten, die zu einem gesamt Locator verkettet werden sollen.
     *  
     *  \~english
     *  
     *  \~
     *  @author Zoltán Hrabovszki
     *  @date 2019.03.28
     */
     @Override
     public void setLocator( String fpsLocator, OKWLocatorBase... fpLocators )
    {
        fourTestLocator fourTestLocator = new fourTestLocator( fpsLocator );


         String myLocator = fourTestLocator.getLocator();
         
         // Enthält xpath oder ein 4Test-Präfix?
         if ( fpsLocator.equals( myLocator ) )
         {
             // Ja es ist ein normaler XPath
             if ( fpLocators != null && fpLocators.length > 0 )
             {
                 super.setLocator( myLocator, fpLocators );
             }
             else
             {
                 super.setLocator( myLocator );
             }
         }
         else
         {
             if ( fpLocators != null && fpLocators.length > 0 )
             {
                 super.setLocator( "$L1$" + myLocator, fpLocators );
             }
             else
             {
                 super.setLocator( myLocator );
             }
         }
     }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy