choose file error: Keyword name cannot be empty.

1,031 views
Skip to first unread message

Christian Rudolf Tan

unread,
Nov 23, 2018, 3:41:40 AM11/23/18
to robotframework-users
Hi robot users,

I tried the choose file keywords. but it seems not working. pls help me. 

I understand that when using choose file:


Choose file   ${location}    ${filepath}

but i am getting this error:

Full Name:Velosi.Keywords.Attached file
Start / End / Elapsed:20181123 16:38:22.961 / 20181123 16:38:33.043 / 00:00:10.082
Status:FAIL (critical)
Message:Keyword name cannot be empty.
00:00:06.836SETUP Common . Begin Web Test about::blank, ${BROWSER}
00:00:00.001KEYWORD ${LeaveRequestbtnChooseFile}, ${filePath} = 
Start / End / Elapsed:20181123 16:38:29.799 / 20181123 16:38:29.800 / 00:00:00.001
16:38:29.799FAILKeyword name cannot be empty.
00:00:03.240TEARDOWN Common . End Web Test

Shiva Prasad Adirala

unread,
Nov 23, 2018, 4:28:25 AM11/23/18
to robotframework-users
Can you provide more information on this. Error in log.html says keyword name cannot be empty

Following info may help to resolve issue:
1. Robot script
2. Html and locator you are using

Christian Rudolf Tan

unread,
Nov 23, 2018, 7:35:03 AM11/23/18
to adiral...@gmail.com, robotframe...@googlegroups.com
Hello  Shiva,

this is my locator
${LeaveRequestbtnChooseFile}   xpath=//div[@id='ContentPlaceHolder1_ContentPlaceHolder1_pnlPopup']/div[@class='popUpContent']/table/tbody/tr[22]/td[3]/input[@id='ContentPlaceHolder1_ContentPlaceHolder1_fileUploadLeave']

this is how i call my keyword
Keywords.Attached file   ${LeaveRequestbtnChooseFile}    C:\\Users\\Christian Tan\\Documents\\Development\\Salttest\\Resources\\attachment.jpg


this is my keyword:

Attached file
[Arguments] ${PELEM} ${filepath}
choose file ${PELEM} ${filepath}

image.png

hope this will help.

Best regards,
chris

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
log.html

Hélio Guilherme

unread,
Nov 23, 2018, 9:00:04 AM11/23/18
to robotframe...@googlegroups.com

That is a common mistake with Robot Framework.
You cannot assign variables directly.

You have to:
${LeaveRequestbtnChooseFile}=    Set Variable    xpath=//div[@id='ContentPlaceHolder1_ContentPlaceHolder1_pnlPopup']/div[@class='popUpContent']/table/tbody/tr[22]/td[3]/input[@id='ContentPlaceHolder1_ContentPlaceHolder1_fileUploadLeave']


Christian Rudolf Tan

unread,
Nov 23, 2018, 9:28:53 AM11/23/18
to robotframework-users
Hello, I am just confused since most tutorials when they create variable  *** Variable  *** 
they always do  

${var} =    xpath=//div....

all of my variables are being created this way and its working.

best regards,
chris 
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Hélio Guilherme

unread,
Nov 23, 2018, 9:43:40 AM11/23/18
to robotframe...@googlegroups.com
You are correct. When is in the *** Variables *** we cannot call keywords.
But in this case the error message is clear 'No keyword with name <the path to file>'
image.png


To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Christian Rudolf Tan

unread,
Nov 26, 2018, 2:47:06 AM11/26/18
to robotframework-users
Hello Hélio Guilherme,


i have different file for my variables. (variable.robot) where i put all variables and I have my webelement.robot file where i put all xpath.

so in my webelemt.robot, this is the content
*** Settings ***

*** Variables ***

${userlogintxt} xpath=//input[@id='txtUserName']
${userpasswordtxt} xpath=//input[@id='txtPassword']
${btnLogin} xpath=//input[@id='btnLogin']
${lnkLogout} xpath=//a[@id='lnkLogout']
${loginpagebanner} xpath=//div[@class='banner rounded-corners']

So when i added ${myvar} =   set variable   xpath//=div/div[@id='myid'] it says element not found. so i switch back to the original.

and

this is my choose file.  also in a different robot file called keywords.robot
Attached file
[Arguments] ${PELEM} ${filepath}
choose file ${PELEM} ${filepath}

then when i use it attached file    ${pelem}       C:\\Users\\Christian Tan\\Documents\\Development\\Salttest\\Resources\\attachment.jpg


the error will be:
No keyword with name 'C:\\Users\\Christian Tan\\Documents\\Development\\Salttest\\Resources\\attachment.jpg' found.

I dont know what is happening seems like it treated the file path as keywords even i put more than two spaces.

hope someone can help.

Best regards,
Chris



To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Tatu Aalto

unread,
Nov 27, 2018, 3:02:22 AM11/27/18
to Christian Rudolf Tan, robotframework-users
Ugh

The error indicates that somewhere in your test data, you are trying to run a variable without calling a keyword. Please read the log.html where this happens and fix your test data. 

-Tatu 

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages