• Helium文档11-WebUI自动化-attach_file上传文件或图片


    前言

    attach_file关键字根据官方介绍的作用是上传文件

    入参介绍

    def attach_file(file_path, to=None):
    """
    :param file_path: The path of the file to be attached.
    :param to: The file input element to which the file should be attached.

    Allows attaching a file to a file input element. For instance::

    attach_file("c:/test.txt", to="Please select a file:")

    The file input element is identified by its label. If you omit the ``to=``
    parameter, then Helium attaches the file to the first file input element it
    finds on the page.
    """

    举例说明

    1、用博客园的上传图片页面举例,当页面上只有一个上传页面的时候可以这么写:

    attach_file(r"c:\1.jpg")

    部分页面的上传按钮不是原生的按钮,需要隐藏其calss

    需要使用selenium执行js代码来实现

    欢迎交流

    310678696

  • 相关阅读:
    cscope的使用
    关于函数指针
    linux内核源码目录(转)
    lcc之内存分配
    符号管理之符号表
    监听UITextFiled文本发生改变
    Debugging Tools for Windows__from WDK7
    WinDBG__独立安装文件
    20160215
    QT Creator 代码自动补全
  • 原文地址:https://www.cnblogs.com/weitung/p/13584529.html
Copyright © 2020-2023  润新知