enter image description here我需要自动附加文件按钮显示在图像上传文件.以前我已经做了这只是使用.Send_Keys("file_name")
,但它不工作here.how我上传文件.pdf/.jpg
在Ruby,这里是HTML代码-
<span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="Attach Files" tabindex="-1">Attach Files</button>
</span>
字符串
我试过的代码-
@driver.find_element(:css,"button.trix-button--icon-attach").click
file = @driver.find_element(:id,"project_content")
file.send_keys("D:\download1.jpg")
sleep 5
型
有什么办法吗?我们可以在ruby中使用Robot类。
我在哪里可以找到类似于Java的Ruby方法/类?
1条答案
按热度按时间mkh04yzy1#
使用
file_field
方法和set
方法。字符串