How to Upload a file from windows explorer


#55

@emine : I marked order of method calls. So as I mentioned, I has to call custom keyword from another custom keyword.

N%C3%A9vtelen


#56

@emine : I try something ike this: How to use @Keyword in other file


#57

@emine : Could you please share your sample project to try it on my side?


#58

hello @plaidshirtakos
As I have shown in the visual, I have 2 functions in a single custom keyword.


#59

Hi Friends,

Thanks in Advance

In my scenario: i need to upload a TXT file Through Windows Dialogue box .Auto IT Feature is not allowed in my Organization.

Can’t we upload without Auto IT.???

if so ,kindly suggest the code to keyin the file path into the windows dialogue box .

Scenario 2:If the Above Scenario Works, can we give path of the txt file from Excel File also…???

if it is yes …kindly suggest the way or code .

Thanq

with Regards,
Mikky…!


#60

hello @mikkili.rahul.tej
The following spelling will be useful.

You can also pull the file path from excel.

CustomKeywords. 'dosya.dosyayukleme.uploadFile(findTestObject(testobject),C: \ Users \ Desktop \ test data file )

In the test case step, you can point to the parameter in the excel data instead of the local file path as the second parameter.

First, create an excel locally and write the path information of the test file to txt and save it.

In the second step, as you can see in the screenshot, include this file in your Katalon project.

Finally, instead of directly typing the file path where you call custom keyword, you should pull it from excel.

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


#61

Hi Emine,

Thanq for the Response …

In my Scenario:I am using Iterations …as My data is 50 Rows in Excel and Each row will be having one TXT file .

Does ur Scenario Works for this design…??

Note:I am Already calling my excel data sheet from local drive.

Thanq

With Regards,
Mikky .


#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…!