我想知道如何从文本框中删除文本。我已经在谷歌上做了很多搜索,但目前什么也没有找到。请告诉我任何关键字,可以帮助我删除/清除字段中的文本。
发布于 2014-03-03 21:34:02
您也可以将其用于清除测试字段。
driver.findElement(By.id("textfieldid")).sendKeys("");//empty字符串
或
空输入文本(您的web元素定位器)${
}
发布于 2014-03-03 21:30:38
你不需要机器人来做这件事。只需使用硒即可。
driver.findElement(By.id("username")).clear();http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html#clear()
发布于 2014-03-03 22:49:27
你不需要它。Check here
def input_text(self, locator, text):
"""Types the given `text` into text field identified by `locator`.
See `introduction` for details about locating elements. """
self._info("Typing text '%s' into text field '%s'" % (text, locator))
self._input_text_into_text_field(locator, text)Input Text关键字正在调用
_input_text_into_text_field 它无论如何都是在发送clear命令:
def _input_text_into_text_field(self, locator, text):
element = self._element_find(locator, True, True)
element.clear()
element.send_keys(text) https://stackoverflow.com/questions/22148055
复制相似问题