Thank you for the above script. I tried using it and it works perfectly fine. The only trouble i have is trying to set the filename to be parameterised. Can you please let me know if we can send the file name as a parameter, and if yes how to go about it?
Thanks a lot in advance.
Hi I am completely new to this . I am not able to understand what to specify in auto It.exe and what in katalon script . Can you please explain little more. I have to upload a file from my system . Thanks in Advance.
Hello I will try to tell you step by step:
You must first define a custom keyword to select a local file and upload it to the project.
To create Custom Keyword:
1-As you will see in the following image; First of all, after creating a new project, right click on the Keywords file in Tests Explorer and follow the steps in the following image and add a new package.
Thank you for your clear step by step guide, it has helped me several steps further.
However there are some parts that I don’t understand.
At step 4 you mention that a variable should be replaced with the variable that I use, I am unsure which part of the provided code you mean by this and what variable I should replace it with.
Could you explain what this variable does and where I should use it?
The provided script runs without errors when I let it click the Browse button on the page that I try to automate. This opens a Windows explorer popup window on a different page than the included URL. Then nothing else happens. See below for the used code:
When I use the input type test object: //input [@type=‘file’] (this is not a visible object) and run the script I receive the following error; com.kms.katalon.core.exception.StepFailedException: Unable to click on object
In my custom keyword the following imports show are warning that they are never used (I am not sure if this is related) import com.kms.katalon.core.annotation.Keyword import com.kms.katalon.core.testobject.TestObject import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
Some further notes on you post, I think step 2 is an accidental copy of step 1. It should have shown the creation of a new Keyword right?
I should point out that I have just started using Katalon a couple of days ago and I am quite inexperienced with coding in general.
With respect to this situation, you should note the variable names in the above code, which I have specified as bold. For example, if you have used the package name Package Test, please write it after the package statement.
Kullanmak zaman giriş tipi deney numunesini: // girişi [@ tipi = ‘Dosya’] (bu görünür bir nesne değil) ve aşağıdaki hata iletisini komut çalıştırmak; com.kms.katalon.core.exception.StepFailedException: Unable to click on object
you should make sure that the object is correctly defined in the Object Repository section.
you must first create a custom keyword and use the code mentioned above for the keyword you created.
Then you should include and use the custom keyword in your project.
WebUI.uploadFile() - Upload file to an input with type = “file” .
if you need to handle windows file uploader then you need to take hep of some other frameworks like robot, sikuli, autoIT ,etc. You can check my blog where steps are mentioned for file upload using Robot framework.