當前位置: 首頁>>代碼示例>>Java>>正文


Java Keys.chord方法代碼示例

本文整理匯總了Java中org.openqa.selenium.Keys.chord方法的典型用法代碼示例。如果您正苦於以下問題:Java Keys.chord方法的具體用法?Java Keys.chord怎麽用?Java Keys.chord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openqa.selenium.Keys的用法示例。


在下文中一共展示了Keys.chord方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: _executeGesture

import org.openqa.selenium.Keys; //導入方法依賴的package包/類
@Override
protected boolean _executeGesture( WebDriver webDriver )
{
	String[] keyCodes = getKeyCode().split("\\+");
	String keyPressed = null;
	List<CharSequence> charSequence = new ArrayList<CharSequence>();
	
	for (String keyCode : keyCodes) {
		
		if (Keys.valueOf(keyCode) != null) {
			charSequence.add(Keys.valueOf(keyCode.toUpperCase()));
		
		} else {
			throw new IllegalArgumentException( "Unsupported KeyPressGesture Type " + keyCode );
		}
		
	}
	
	if (charSequence.size() > 0) {
		Iterable<CharSequence> iterable = charSequence;
		keyPressed = Keys.chord(iterable);
		new Actions( webDriver ).moveToElement( webElement ).sendKeys(keyPressed).perform();
	}
	return true;
}
 
開發者ID:xframium,項目名稱:xframium-java,代碼行數:26,代碼來源:KeyPressGesture.java

示例2: pressKeyCombination

import org.openqa.selenium.Keys; //導入方法依賴的package包/類
/**
 * Эмулирует нажатие сочетания клавиш на клавиатуре.
 * Допустим, чтобы эмулировать нажатие на Ctrl+A, в таблице должны быть следующие значения
 *  | CONTROL |
 *  | a       |
 *
 * @param keyNames название клавиши
 */
@И("^выполнено нажатие на сочетание клавиш из таблицы$")
public void pressKeyCombination(List<String> keyNames) {
    Iterable<CharSequence> listKeys = keyNames.stream()
        .map(this::getKeyOrCharacter)
        .collect(Collectors.toList());
    String combination = Keys.chord(listKeys);
    WebDriverRunner.getWebDriver().switchTo().activeElement().sendKeys(combination);
}
 
開發者ID:alfa-laboratory,項目名稱:akita,代碼行數:17,代碼來源:DefaultSteps.java

示例3: _executeAction

import org.openqa.selenium.Keys; //導入方法依賴的package包/類
@Override
public boolean _executeAction( WebDriver webDriver, List<Object> parameterList )
{
	String executionId = getExecutionId( webDriver );
	String deviceName = getDeviceName( webDriver );
	
	String applicationName = (String) parameterList.get( 0 );

	ApplicationDescriptor appDesc = ApplicationRegistry.instance( ( (DeviceWebDriver) webDriver).getxFID() ).getApplication( applicationName );
	
	if ( appDesc == null )
	    throw new ScriptConfigurationException( "The Application " + applicationName + " does not exist" );

	
	if ( appDesc.isWeb() )
	{
   		String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");
   		if ( webDriver.getWindowHandles() != null && webDriver.getWindowHandles().size() > 0 )
   		    webDriver.findElement(By.tagName("body")).sendKeys(selectLinkOpeninNewTab);
   		
   		webDriver.get( appDesc.getUrl() );
   		( (DeviceWebDriver) webDriver ).setAut( appDesc,  ( (DeviceWebDriver) webDriver ).getxFID()  );
   		    
	}
	else
	{
   		Handset localDevice = PerfectoMobile.instance( ( (DeviceWebDriver) webDriver ).getxFID() ).devices().getDevice( deviceName );
   		Execution appExec = null;
   		if ( localDevice.getOs().toLowerCase().equals( "ios" ) )				
   			appExec = PerfectoMobile.instance( ( (DeviceWebDriver) webDriver ).getxFID() ).application().open( executionId, deviceName, appDesc.getName(), appDesc.getAppleIdentifier() );
   		else if ( localDevice.getOs().toLowerCase().equals( "android" ) )
   			appExec = PerfectoMobile.instance( ( (DeviceWebDriver) webDriver ).getxFID() ).application().open( executionId, deviceName, appDesc.getName(), appDesc.getAndroidIdentifier() );
   		else
   			throw new IllegalArgumentException( "Could not install application to " + localDevice.getOs() );
   		
   		if ( appExec != null )
   		{
   		    if ( appExec.getStatus().toLowerCase().equals( "success" ) )
   		    {
   		        if ( webDriver instanceof ContextAware )
   	                ( ( ContextAware ) webDriver ).context( "NATIVE_APP" );
   		        
   		        ( (DeviceWebDriver) webDriver ).setAut( appDesc,  ( (DeviceWebDriver) webDriver ).getxFID()  );
   		        return true;
   		    }
   		    else
   		        throw new ScriptException( "Failed to launch application " + appDesc.getName() );
   		}
   		else 
   		    throw new ScriptException( "Failed to launch application " + appDesc.getName() );
   		
   		
	}
	return true;
}
 
開發者ID:xframium,項目名稱:xframium-java,代碼行數:56,代碼來源:OpenApplicationAction.java


注:本文中的org.openqa.selenium.Keys.chord方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。