我使用 Windows Phone 和 RemoteWebDriver,但是当我尝试使用“SendKeys”方法时,我收到了这个错误:
Unexpected error. Call could not be fullfield. JavaScript injection failed.
例子 :
driver.FindElement(By.Id("ID")).SendKeys("string");
此致,
夏露娜
我使用 Windows Phone 和 RemoteWebDriver,但是当我尝试使用“SendKeys”方法时,我收到了这个错误:
Unexpected error. Call could not be fullfield. JavaScript injection failed.
例子 :
driver.FindElement(By.Id("ID")).SendKeys("string");
此致,
夏露娜
所以,我找到了解决办法。
我创建了一个这样的新函数:
public void javascriptSendKeys(String id, String value)
{
String script = "document.getElementById(\"" + id + "\").value=\"" + value + "\" ";
((IJavaScriptExecutor)driver).ExecuteScript(script);
}
当我需要使用 SendKeys 方法时,我会使用它。
这对我来说很好。
祝你今天过得愉快 !
夏露娜