ITPub博客

首页 > 数据库 > > Helium文档4-WebUI自动化-write写入

Helium文档4-WebUI自动化-write写入

作者:LCR_ 时间:2022-04-12 16:10:43 0 删除 编辑

前言

write方法是模拟在输入框中写入数据

write入参说明

def write(text, into=None): """ :param text: The text to be written. :type text: one of str, unicode :param into: The element to write into. :type into: one of str, unicode, :py:class:`HTMLElement`, \ :py:class:`selenium.webdriver.remote.webelement.WebElement`, :py:class:`Alert` Types the given text into the active window. If parameter 'into' is given, writes the text into the text field or element identified by that parameter. Common examples of 'write' are:: write("Hello World!") write("user12345", into="Username:") write("Michael", into=Alert("Please enter your name")) """ _get_api_impl().write_impl(text, into)

write案例分析

1、常规输入框中有提示信息的写法
write("123456", into="邮箱帐号或手机号码")
time.sleep(5)
write("123456", into="输入密码")


2、输入框没有提示信息的情况

假设上面输入框即没有id,也没有提示信息
write("Helium", into=S(".edit"))

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70000523/viewspace-3155955/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2022-02-22

  • 博文量
    1402
  • 访问量
    15007