【问题标题】:ElementNotInteractableException when Choosing a File in Robot Framework在 Robot Framework 中选择文件时发生 ElementNotInteractableException
【发布时间】:2020-02-15 21:17:32
【问题描述】:

我正在尝试在机器人框架(在 Eclipse 中)中自动上传网站中的图像。我正在使用关键字选择文件以及图像上传按钮的定位器和完整的文件路径。您选择要上传的图像文件的网站上的按钮是选择图像按钮。 但我得到的错误是元素不可交互。

文件路径 = /Users/name/Desktop/hello1.png 镀铬版本=77.0.3865.120 macOS = 10.14.6

我已尝试使用关键字将元素滚动到视图中并等待元素可见以尝试排除故障。

Scroll Element Into View //label[text()='Choose an Image']
Capture Element Screenshot    //label[text()='Choose an Image'] 
element.png  
Wait Until Element Is Visible    //label[text()='Choose an Image']  
Click Element                //label[text()='Choose an Image']         
Choose File     //label[text()='Choose an Image']    ${path}

【问题讨论】:

    标签: selenium robotframework


    【解决方案1】:

    Choose File 要求您为其提供输入元素的路径。您不能将定位器赋予标签。

    【讨论】:

      【解决方案2】:

      你可以试试这个方法!

      Wait Until Element Is Enabled   xpath://label[text()='Choose an Image']
      Choose File    xpath://label[text()='Choose an Image']    ${path}
      

      【讨论】:

      • 这里的重点是使用Choose File关键字时不需要点击元素。
      • 是的,当你使用Choose File关键字时,你不需要点击那个元素,对我来说它的工作。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-18
      • 2018-06-05
      • 2018-04-27
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多