I need to close the File Upload window of a browser. I tried the following code to achieve this
Press Key id=fileToUpload \\27
- I found the ascii character in the URL http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html
My Complete code is
*** Variables ***
${TVAURL} http://localhost:1500/
${Browser} Firefox
TC_01: Enter into the application
[Documentation] Enter into the application to upload a file
Open Browser ${TVAURL} ${Browser}
Choose File id=fileToUpload C://Downloads/Demo/rose.png
Press Key id=fileToUpload \\27
My respective sample HTML code is
<!DOCTYPE html>
<html>
<head>
<title>Upload File</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<br/>
<input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
It gives the error message WebDriverException: Message: File not found : //27
I need to close the file uploader window of a browser, once the file gets uploaded (i.e., next to the Choose File
command)
Once you upload the file you need to click the submit button on the website and not uploadfile again with the wrong locator..
Change your last line from:
Press Key id=fileToUpload
to
Press Key name=submit
That should do it for you.