了浓厚的兴趣阅读了这个问题后,详细了解方法和冲压解决这个谷歌搜索:
IME - 代表输入法引擎。目前看来这只是在Linux平台和Firefox浏览器中才支持的。
当与在Linux中硒需要输入中国/日本或者多字节字符的工作,你必须使用像IBus输入框架和像anthy(日本)对下iBus实施的引擎,pinyin(中国)。
下面的代码示例来自Selenium的I18NTest.java,它寻找anthy
引擎以在Linux机器上输入日文字符。
@NeedsFreshDriver
@Ignore(value = {IE, CHROME, FIREFOX},
reason = "Not implemented on anything other than Firefox/Linux at the moment.")
@NotYetImplemented(HTMLUNIT)
@Test
public void testShouldBeAbleToActivateIMEEngine() throws InterruptedException {
assumeTrue("IME is supported on Linux only.",
TestUtilities.getEffectivePlatform().is(Platform.LINUX));
driver.get(pages.formPage);
WebElement input = driver.findElement(By.id("working"));
// Activate IME. By default, this keycode activates IBus input for Japanese.
WebDriver.ImeHandler ime = driver.manage().ime();
List<String> engines = ime.getAvailableEngines();
String desiredEngine = "anthy";
if (!engines.contains(desiredEngine)) {
System.out.println("Desired engine " + desiredEngine + " not available, skipping test.");
return;
}
ime.activateEngine(desiredEngine);
int totalWaits = 0;
while (!ime.isActivated() && (totalWaits < 10)) {
Thread.sleep(500);
totalWaits++;
}
assertTrue("IME Engine should be activated.", ime.isActivated());
assertEquals(desiredEngine, ime.getActiveEngine());
// Send the Romaji for "Tokyo". The space at the end instructs the IME to convert the word.
input.sendKeys("toukyou ");
input.sendKeys(Keys.ENTER);
String elementValue = input.getAttribute("value");
ime.deactivate();
assertFalse("IME engine should be off.", ime.isActivated());
// IME is not present. Don't fail because of that. But it should have the Romaji value
// instead.
assertTrue("The elemnt's value should either remain in Romaji or be converted properly."
+ " It was:" + elementValue, elementValue.equals(tokyo));
}
注意:我的回答可以提供关于一个公平的想法,还是更多的见解,可以通过硒提交者改善,因为我看到这个功能没有被广泛使用,并且还具有有限的支持(只在Linux中)。
它实际上代表的输入法引擎 - 看到https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebDriver.ImeHandler.html一个通用的接口,用于处理用户输入(例如通过键盘,鼠标或其他输入如触摸屏上的软键盘,游戏控制器等) – fijiaaron 2016-02-16 22:41:55
IME是输入法编辑器而不是引擎....有关IME的详细信息可以在https://www.w3 .org/TR/ime-api/ – Pooja 2016-05-24 03:32:45
fijiaaron,pooja - 修正后的IME定义。 – parishodak 2016-06-03 17:45:34