zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    ARM处理器
    进程和线程通俗理解
    const与指针
    字符提取命令
    ThinkPHP之视图模版的使用
    ThinkPHP之MVC与URL访问
    ThinkPHP之项目搭建
    android之文件存储和读取
    cryptdb中wrapper.lua的分析
    cryptDB安装分析
  • 原文地址:https://www.cnblogs.com/weitung/p/13584529.html
Copyright © 2011-2022 走看看