Unexpected Token

I am trying to upload a file using a custom keyword but I am getting an “unexpected token” error in the script.

The upload keyword works in other tests but for some reason it is not working here.

image

How do I fix the unexpected token error?

Thanks!

Unexpected token is now starting to show up in other tests. I am not sure what’s going on. :confused:

@marias Can you please post your full code, including the custom keyword, test, and full error message?

@matt.thurman

WebUI.openBrowser(’’)

WebUI.navigateToUrl(‘somethingsomethingwebsite’)

WebUI.click(findTestObject(‘Page_evident Design/form_User name’))

WebUI.setText(findTestObject(‘Object Repository/Page_evident Design/input_User name_username’), ‘somethingsomething’)

WebUI.setEncryptedText(findTestObject(‘Object Repository/Page_evident Design/input_Password_password’), ‘gkKKHHd7u4q8sLvsAburNQ==’)

WebUI.click(findTestObject(‘Object Repository/Page_evident Design/button_Sign in’))

// Click assign to me button
WebUI.delay(5)

WebUI.click(findTestObject(‘Object Repository/Page_Designer Dashboard/span_Assign to me’))

WebUI.delay(10)

// Click download file button (double check the xpath recorded by recorder - sometimes it does not work/not correct syntax)
WebUI.click(findTestObject(‘Object Repository/Page_Designer Dashboard/span_Download case file(s)’))

// Click submit case button
WebUI.delay(10)

WebUI.click(findTestObject(‘Page_Designer Dashboard/button_Submit design files(s))’)

//file upload

CustomKeywords.‘testpackage.test.uploadFile2’(findTestObject(‘Page_Designer Dashboard/upload_case_button’), ‘C:\Users\Nimbyx\Documents\Test_Files\test_case_submit.zip’)

It won’t let me execute the script since I have “errors in the script” so I can’t attach the error log :confused: Thanks so much!!!

@matt.thurman

even if I remove the custom keyword line… the unexpected token error appears in the line before. Not too sure why.

hi,

what Katalon Problems tab say?

You’re missing a parenthesis. The line before your customkeyword.
It should be :
WebUI.click(findTestObject(‘Page_Designer Dashboard/button_Submit design files(s))’))

EDIT: I think the parenthesis is inside the object and should be outside, So it should be :

WebUI.click(findTestObject(‘Page_Designer Dashboard/button_Submit design files(s)’))

1 Like