【问题标题】:I want to use my Robotframework to upload file but my fileupload fill has no ID我想使用我的 Robotframework 上传文件,但我的文件上传填充没有 ID
【发布时间】:2020-01-24 03:39:01
【问题描述】:

我想上传我的图片,但我的上传填充没有 id,因为它是有角度的,我的程序员拒绝为我写一些 id。

问题是我如何找到我的机器人来填写上传文件? 因为我尝试输入一些文本,但无论如何它都不起作用 (对不起,我的英语技能不好,这是我第一次问这样的问题)

This is my html tag

    <input _ngcontent-yhb-c11 style="display: none;" type="file">

This is my robot code

Right Input test
Location Should Be  https://app.smartfinder.asia/operation/core/right/right-user-signup
Input Text    name=UserCode    ${Email}
Click Element    xpath=//*[contains(text(),'Adds')]
Click Element   xpath=//*[@class='signup-picture']
Choose File  xpath =//input[_ngcontent-ctj-c11]  C:\\Users\\User\\Desktop\\CabinetRB\\Reset passcode.PNG

我希望上传我的文件,但没有发生任何事情 希望你们能明白我想说的话 我是这个工具的新手,谢谢帮助

【问题讨论】:

  • 欢迎来到stackoverflow!请阅读minimal reproducible example 并相应地编辑您的帖子。没有人会从图像中编写代码来帮助您,将该代码作为问题的一部分添加为代码,就像帮助我,帮助你!
  • @Dev 。我编辑你所说的 Dev thx 以通知我的问题
  • 如果您正确识别 type='file' 的输入,Choose File 将起作用。但是您不应该激活浏览器文件选择器。您必须使用 xpath 根据可识别的父级来定位输入。
  • @Helio 所以我按照你所说的进行编辑,但它没有工作它说'找不到带有定位器'xpath =//input[_ngcontent-ctj-c11]'的元素。'先生,我现在该怎么办

标签: automated-tests robotframework selenium2library


【解决方案1】:

好的,我找到了如何解决我通过使用 style="display: none;" 确定的解决方案所以谢谢你帮助 Helio

Choose File  xpath =//input[@style='display: none;']  C:\\Users\\User\\Desktop\\CabinetRB\\Reset passcode.PNG

【讨论】:

    猜你喜欢
    • 2020-04-19
    • 2013-07-07
    • 2012-07-10
    • 1970-01-01
    • 2012-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多