无法使用 Robot Framework 上传 .jpg 图像
Not able to upload a .jpg image using Robot Framework
我正在尝试使用 Choose file | Locator | File Path
命令在网页中上传 .jpg 文件。但它只是打开 Windows 文件夹,而不是导航到我给出的文件路径。
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${Home_Page_URL} https://34.239.9.24:8443/LIVMOR/
${FilePath} C:\Users\20073018\Desktop\Pranesh_Kulkarni.jpg
*** Test Cases ***
.
.
TC9-Change Profile Picture
Click Element xpath=//a[@onclick="openAttachment()"]
Choose File xpath=//a[@onclick="openAttachment()"] ${FilePath}
您应该而不是单击打开文件选择器的元素。相反,您在用于将文件名传递给服务器的输入元素上调用 choose file
。 choose file
的重点是避免弹出对话框,因为 selenium 无法控制对话框。
我正在尝试使用 Choose file | Locator | File Path
命令在网页中上传 .jpg 文件。但它只是打开 Windows 文件夹,而不是导航到我给出的文件路径。
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${Home_Page_URL} https://34.239.9.24:8443/LIVMOR/
${FilePath} C:\Users\20073018\Desktop\Pranesh_Kulkarni.jpg
*** Test Cases ***
.
.
TC9-Change Profile Picture
Click Element xpath=//a[@onclick="openAttachment()"]
Choose File xpath=//a[@onclick="openAttachment()"] ${FilePath}
您应该而不是单击打开文件选择器的元素。相反,您在用于将文件名传递给服务器的输入元素上调用 choose file
。 choose file
的重点是避免弹出对话框,因为 selenium 无法控制对话框。