How to Upload a file from windows explorer


#62

Hi, the scenario works for txt file.


#63

Hi Emine,

i repeat my question once again

Iteration 1:Will open application and upload the file and close the Application and this process will repeat for 5 iterations…

does ur scenario help me on the above 5 iterations iterations…??

Thanq

With Regards,
Mikky


#64

@mikkili.rahul.tej
Hello , In the application you can find the solution using the custom keyword u for 5 times.
The keyword we create allows you to upload any file on your computer to the corresponding area.
This process will automatically select and load the file from the windows popup.


#65

Hi Emine,

I had stucked at step 1 only .The Test object is having issue …i cannot able to click on the specific object .

the object is in IFrame and object is hidden . i had tried in many ways but all in Vain .

Without Test object can we able to try ur code …?? if Yes can u guide me …

Thanq

With Regards,
Mikky…!


#66

hello @mikkili.rahul.tej

In the recording phase of the test, it will be added to the object repostory folder by right-clicking it.
Then use this object path and file url for the custom keyword.


#67

Tried Emine …cannot able to click on the object .

Issue :need to click on upload object but object property cannot click exactly over their .it s doing operation on entire field.so thts why cannot able to get window popup

object is in the IFrame .

Refer to the screen shot attached for image and object properties .

Thanq

With Regards,
Mikky …!!

UploadIssue|690x163
Uploadissue2|534x122


#68

@Keyword
def uploadFile2 (TestObject to, String filePath , String file , String file2) {
WebUI.click(to)
StringSelection ss = new StringSelection("""+filePath+"" " +"""+ file +"" "+ file2 );
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL)
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
}

Hello Again @mikkili.rahul.tej
Then remove the object click from the Keyword code and try again.
Of the above codes, I’m marking bold ones related to object clicks. Wipe them off the code. Recall Keyword and try.


#69

Hi Emine,

thank you for the code …that works for me without using Test Object .

now when i am trying your code to give the Path from Excel.its not working .i had followed your steps from the above responses.

My code:
CustomKeywords.‘keywordPackage.UploadSingleFile.uploadFile01’(‘findTestData(‘Delete’).getValue(1,60)’)

Your Code

CustomKeywords.‘dosya.dosyayukleme.uploadFile’(findTestObject(testobject), findTestData(‘New Test Data’).getValue(1, 1) )

Attached the screen shot for your reference

Thanq

With Regards,
Mikky


#70

Hi

Remove the quote
CustomKeywords.'keywordPackage.UploadSingleFile.uploadFile01'(findTestData('Delete').getValue(1,60))


#71

Hello @mikkili.rahul.tej

CustomKeywords.‘dosya.dosyayukleme.uploadFile this code should only take one parameter, it should be your file path.
When defining the file path, please make sure that it is double as C: // User // …
If you are pulling this file path from Excel content, please let // be defined in the statements in excel.


#72

Hi HeleneB

its working …but i am looking for the code to retrieve the value from excel using custom keyword.

CustomKeywords.‘keywordPackage.UploadSingleFile.uploadFile01’(findTestData(‘Delete’).getValue(1,2))

can we do something with the above code …??

Thanq

With Regards,
Mikky


#73

Import your Excel doc on the Data File from KatalonStudio
Right click on Data Files folder then New / Test Data / Excel File / Browse your file. Then your keyword should work


#74

let me try and get back to u …

Thanq

With Regards,
Mikky…!


#75

Issue Resolved …

Thanks for your contribution @emine and @HeleneB

Thanq

With Regards,
Mikky…!


#76

Thanks a lot, that is working well!


#77

Using above script, i have added “WebUI.delay(3)” two times… it’s working fine…


#78
@Keyword
def uploadFile (TestObject to, String filePath) {
	WebUI.click(to)
	WebUI.delay(3) //Delay after click on Browser Button
	StringSelection ss = new StringSelection(filePath);
	Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
	WebUI.delay(1) //Delay after paste the text
	Robot robot = new Robot();
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
	robot.keyPress(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_V);
	robot.keyRelease(KeyEvent.VK_CONTROL);
	robot.keyPress(KeyEvent.VK_ENTER);
	robot.keyRelease(KeyEvent.VK_ENTER);
}