Hello Again @rushantha
1.Step : Please refresh the keyword folder.
2.Step : Open your Test Case page and add a custom keyword from the ADD field.
Hello Again @rushantha
1.Step : Please refresh the keyword folder.
2.Step : Open your Test Case page and add a custom keyword from the ADD field.
Itâs missing @Keyword
before def uploadFile(TestObject tp, String filePath)
Hello @HeleneB
In the custom keyword definition, the relevant phrase exists, has it added? couldnât tell where missing.
Thanks @emine⌠you did great help for me⌠thanks a lot⌠now it is successfully happeningâŚ
@rushantha Hello Again
Youâre welcome. If thereâs something I can help you with, you can send it back.
sureâŚ
I am also trying this solution , but seems it is not working for me aswell,
GenericActions.uploadFile(findTestObject(âObject Repository/Banner/applicationNavigator/SZADOCS/Page_Application Navigator/upload_buttonâ),âC:\Users\shilpi\Upload test.docxâ)
upload classâ
def static uploadFile(TestObject to, String filePath) {
WebUI.click(to)
StringSelection ss = new StringSelection(filePath)
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)
}
It is working for me⌠Sometimes it is getting stuckâŚbut most of the time it is working
Do we need to dd any plugin for this? bcz I hvnt.
I have element which get active on mouse hover.
First I have to hover mouse on element then upload files by click on that.
Three Actions at a time âŚplease guideâŚ
Mouse Hover, click and file upload
Can you please read and try with methods in this topic ⌠Katalon Studio Native Popup Window and Upload File
Ya I tried, its not working that may be because here I need to perform mouse hover first
fixed, its working nowâŚThanks guys:)
âUnable to upload fileâ
my custom keyword
package upload
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testcase.TestCaseFactory
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords
import internal.GlobalVariable
import MobileBuiltInKeywords as Mobile
import WSBuiltInKeywords as WS
import WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.WebElement
import org.openqa.selenium.WebDriver
import org.openqa.selenium.By
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObjectProperty
import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper
import com.kms.katalon.core.util.KeywordUtil
import com.kms.katalon.core.webui.exception.WebElementNotFoundException
import java.awt.Robot
import java.awt.Toolkit
import java.awt.datatransfer.StringSelection
import java.awt.event.KeyEvent
class uploadclass {
/**
*/
@Keyword
def uploadFile (TestObject to, String filePath) {
WebUI.click(to)
StringSelection ss = new StringSelection(filePath);
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);
}
}
the script:
WebUI.callTestCase(findTestCase(âSelf Sender/01. Loginâ), [:], FailureHandling.STOP_ON_FAILURE)
WebUI.click(findTestObject(ânuovo mezzo/Page_C Scrivania/span_Mezziâ))
WebUI.click(findTestObject(ânuovo mezzo/Page_C Mezzi/button_Nuovo mezzoâ))
WebUI.setText(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/input_Targa_vehicle_plateâ), â2aaasdfghâ)
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/button_Anno del mezzoâ))
WebUI.setText(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/anno_mezzoâ), â2019â)
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/seleziona_dataâ))
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/button_Classe mezzoâ))
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/a_Autocarroâ))
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/button_Configurazione mezzoâ))
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/a_Cabinatoâ))
WebUI.click(findTestObject(ânuovo mezzo/Page_C Nuovo mezzo/button_Salvaâ))
WebUI.click(findTestObject(âedit mezzo/Page_C Mezzi/button_okâ))
WebUI.setText(findTestObject(âelimna mezzo/Page_C Mezzi/input_Capacit di carico_form-controlâ), â2â)
WebUI.click(findTestObject(âedit mezzo/Page_C Mezzi/td_2aaasdfghâ))
WebUI.click(findTestObject(âedit mezzo/Paage_C Dettaglio mezzo/button_Nessun driver predefinitoâ))
WebUI.click(findTestObject(âedit mezzo/Page_C Dettaglio mezzo/a_demo 102 autistaâ))
WebUI.click(findTestObject(âedit mezzo/Page_C Dettaglio mezzo/input_Foto mezzo_vehicle_coverâ))
CustomKeywords.âupload.uploadclass.uploadFileâ(findTestObject(âDatalocker/Add-Dataset-Buttonâ), â/Users/âŚ/img.jpgâ)
WebUI.click(finTestObject(âDatalocker/Add-Dataset-Buttonâ))
Hi, so i used the keyword and it navigates to the path but does not find my file any assistance please
Ok cool i managed to sort my issue out, added in a delay after the custom keyword , maybe it couldnt find the file that quick.
This post really helpfull. Thank you soo much
Iâm new to these languages and this application, so forgive me if some of the below is nonsense/unnecessary.
For others who may still be having an issue, I believe my issue was that I had previously tried to implement the plugin from the Katalon Store and it was somehow conflicting with my new keyword (maybe I was using the same keyword). This is how I followed this tutorial and resolved the error I donât see mentioned above:
Thanks @emine for the guide. I would like to see some more images though, especially showing what manual and script execution window looks like after itâs configured correctly and without tooltips.