这是我的代码
*** Settings ***
Library Selenium2Library
*** Variables ***
${Login} xpath=/html/body/app/main/login/div/div[1]/div/form/div[3]/div/button
*** Test Cases ***
Test
OPEN
LOGIN
Sleep 5s
ADD TOPIC
Sleep 2s
SelectType
TypePDF
Sleep 5s
AddFile
*** Keywords ***
OPEN
Open Browser https://********** \ \ \ googlechrome
LOGIN
Input Text id=inputEmail3 ********
Input Text id=inputPassword3 *******
Click Element xpath=/html/body/app/main/login/div/div[1]/div/form/div[3]/div/button
ADD TOPIC
Click Element xpath=/html/body/app/main/pages/div/div/news/div/news-list/button
SelectType
Click Element id=selectType
TypePDF
Click Element xpath=//*[@id="selectType"]/option[5]
AddFile
Click Button xpath=/html/body/app/main/pages/div/div/news/div/news-add/ba-card/div/div[2]/div[2]/div[1]/div[2]/ba-file-uploader/div/span/button
Sleep 2s
Choose File <input type="file" id="myFile"> C:{/}User${/}pr.com${/}Download${/}base.png
Addpicture
Choose File //input[@type='file'] C:\Users\pr.com\Downloads\b.jpg
这是结果
Test
| FAIL |
File 'C:{/}User\pr.com\Download\base.png' does not exist on the local file system
我用:
Python version 2.7.14
Robotframework ride 1.5.2.1