如何通过SendKeys发送特殊字符? [英] How do I send special characters via SendKeys?

查看:266
本文介绍了如何通过SendKeys发送特殊字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Selenium2中填写表格.

I'm trying to fill out a form in Selenium2.

一个输入具有我想关闭的自动完成功能,最好通过在搜索词之后发送 esc 来关闭. IE.类似于driver.FindElement(By.Id("InputWithAutocomplete")).SendKeys("SearchTerm/ESC");

One input has an autocomplete that I want to close, preferably by sending esc after the search term. I.e. something like driver.FindElement(By.Id("InputWithAutocomplete")).SendKeys("SearchTerm/ESC");

密钥包括 del ctrl + a .

是否有我可以使用的特殊字符列表?

我正在将Selenium与FirefoxDriver一起用于.NET 2.8.

I'm using Selenium for .NET 2.8 with the FirefoxDriver.

推荐答案

尝试一下:

WebElement list1;    
list1=firefoxDriver.findElement(By.name("lst")); 
list1.sendKeys(Keys.CONTROL);

这篇关于如何通过SendKeys发送特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆