当前位置: 首页>>代码示例>>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;未经允许,请勿转载。