robotframework上传文件相对路径怎么写

robotframework上传文件相对路径怎么写,第1张

choose file

官方给定的解释如下:

Source:

Selenium2Library <test library>

Arguments:

[ locator | file_path ]

Inputs the `file_path` into file input field found by `identifier`.

This keyword is most often used to input files into upload forms. The

file specified with `file_path` must be available on the same host where

the Selenium Server is running.

Example:

Choose File my_upload_field /home/user/files/trades.csv

一开始以为进入到上传页面,点击浏览,再使用choose file,结果发现,这个函数包含了 点击浏览--选中文件 那么点击浏览就是多余的 *** 作了

在该页面,就只需要执行choose 就可以将图片选中,执行的具体丛兄命令为:

choose filexpath=//div[@class='pd6 dot fcb']/span/input

C:\\Documents and Settings\\zhouxuan\\My Documents\\纳郑神My

Pictures\\bug5.png

其中xpath为选中浏览图标的路径,而 C:\\Documents and Settings\\zhouxuan\\My Documents\\My Pictures\\bug5.png(此处的\\为转义用,当只用\时会出现错误)则为需要上传的图片的路径。

该 *** 作执行完毕后,则会显示为:

图片洞亏已经顺利加载进来了,后续的 *** 作就很简单了。

choose file中文翻译是选择文件、选取文件、选择资料、选择档案等意思。

双语翻译:

1.Choose a file or data store for persistence, then Next。

翻译:选择用于进行持久 *** 作的文件或数据存储,然后单击 Next。

2.Choose a file from the course files area. The fourth option is a list of options for the element。

翻译:从进程文件区域选择一个文件。第四个选项是该数郑穗据项的选项列表。

3.Therefore, choose a file name and location for the XML document (see Figure 15) as well as for the XML schema (see Figure 喊蠢卜16).

翻译:因此,为 XML 文档段档(见图 15)和 XML 模式(见图 16)选择一个文件名和位置。

1、首先,你要对form表单设置下相关属性,增加如下属性:

enctype="multipart/form-data" action="接收上传文件的后台处理URL" method="post"

<form enctype="multipart/form-data" action="" method="post">

    <input type="file" id="choosefile" />

    <input type="file"  id="f" style="display:none" />

    <input type="submit" value="上传文件" id="submitBtn" />

</form>

2、编写接收客户端文件上传庆搏的后台代码,即上面提到的“接收上传文件的后台处理URL”的相关代码。升穗

3、当点击上面增加吵差卜的“上传文件”按钮后,将调用action对应的处理方法进行文件上传

因为不知道你是使用什么语句作为后台程序的运行语句,这里没法给出示例。像很多都有现成的插件。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12281342.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存