selenium 使用键盘时 提示java.lang.IllegalArgumentException: Key Down / Up events only make sense for modifier keys.

输入某个内容后,使用enter键进行确认,最开始使用方式为:

driver.findElement(By.xpath("//input[@name=‘supplier_name‘][@id=‘js_productSupplier‘]")).sendKeys("输入内容");
Actions action=new Actions(driver);
action.keyDown(Keys.ENTER).perform();

运行时,提示java.lang.IllegalArgumentException: Key Down / Up events only make sense for modifier keys.

百度了下是说enter不能单独使用,需要和ctrl或者ALT的键配合使用,我的使用是

action.keyDown(Keys.ALT).keyDown(Keys.ENTER).perform();

但是还是提示这个key down的错误

查看其它API,发现能不能直接使用sendkeys直接输入发现keys.enter,也可以正常执行回车键

driver.findElement(By.xpath("//input[@name=‘supplier_name‘][@id=‘js_productSupplier‘]")).sendKeys("输入内容");
Actions action=new Actions(driver);

action.sendKeys(Keys.ENTER).build().perform();

时间: 2024-10-10 02:01:52

selenium 使用键盘时 提示java.lang.IllegalArgumentException: Key Down / Up events only make sense for modifier keys.的相关文章

在访问jsp时抛java.lang.IllegalArgumentException: Page directive: invalid value for import的原因

问题:java.lang.IllegalArgumentException: Page directive: invalid value for import 环境:tomcat 7.0.65 出错原因: 在index.jsp中的%@page import="java.util.Calendar;"%语句中,在导完包后加了分号,导致抛出异常. 把分号删除掉就OK了

压缩/解压 zip 时遇到 java.lang.IllegalArgumentException: MALFORMED

错误详情: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "mai

FlashBuilder 新建项目时提示 java.lang.nullpointerexception

可以尝试安装 Air SDK

使用Retrofit时出现 java.lang.IllegalArgumentException: URL query string "t={type}&p={page}&size={count}" must not have replace block. For dynamic query parameters use @Query.异常原因

/** * Created by leo on 16/4/30. */ public interface GanchaiService { @GET("digest?t={type}&p={page}&size={count}") Call<List<GanChaiEntry>> ListGanchaiEntry(@Path("type") int type , @Path("count") int cou

图片缩放时java.lang.IllegalArgumentException: pointerIndex out of range解决方案

版权声明:本文为博主原创文章,未经博主允许不得转载. 06-03 20:45:24.143: E/AndroidRuntime(1230): FATAL EXCEPTION: main06-03 20:45:24.143: E/AndroidRuntime(1230): java.lang.IllegalArgumentException: pointerIndex out of range06-03 20:45:24.143: E/AndroidRuntime(1230): at androi

图片缩放时java.lang.IllegalArgumentException: pointerIndex out of range

06-03 20:45:24.143: E/AndroidRuntime(1230): FATAL EXCEPTION: main 06-03 20:45:24.143: E/AndroidRuntime(1230): java.lang.IllegalArgumentException: pointerIndex out of range 06-03 20:45:24.143: E/AndroidRuntime(1230): at android.view.MotionEvent.native

springmvc与mybatis整合时 java.lang.IllegalArgumentException: Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required 异常

今天在整合springmvc与mybatis时,启动服务器遇到这样一个问题, by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.util.Assert.notNull(Assert.java:112) 异常的意思是  缺少sqlSessionFactory 或者是  sqlSessionTe

java.lang.IllegalArgumentException: Wrong state classs

java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class cn.etouch.ecalendar.waterfallview.StaggeredGridView$GridListSavedState instead. This usually happens when two views of different type have the same id in t

java.lang.IllegalArgumentException: Receiver not registered

错误提示:java.lang.IllegalArgumentException: Receiver not registered. 顾名思义就是Receiver没有被注册,这是由于取消了没有注册的Receiver导致的错误. 我们使用Receiver时必须保证注册(register)和反注册(unregister)成对出现. 遇到这种问题时,你需要检查下自己代码中注册和反注册的代码,看下是否存在多次调用unregister的时候. 很多时候都是想当然认为会那样,但是程序中可能有我们未预料的出口,