Millisecond Forums

Could not locate element

https://forums.millisecond.com/Topic18042.aspx

By KC - 1/6/2016

Hi,

We have been programming an stIAT and it runs just fine on the laptops. It also runs without any problems from Inquisit web. However, when we want to run the task embedded in our Qualtrics survey, we get the following error messages:

1) Could not locate element 'block1'.
2) Block2 is unassigned.

I was wondering if someone could check whether there are any errors in the script or whether we have to look for the error somewhere else (e.g. within Qualtrics). Thanks very much!

***********************************************************************
<item attributeAlabel>
/1 = "Positive"
</item>

<item attributeA>
/1 = "genuine"
/2 = "happy"
/3 = "sincere"
/4 = "friendly"
/5 = "smart"
</item>

<item attributeBlabel>
/1 = "Negative"
</item>

<item attributeB>
/1 = "cruel"
/2 = "dumb"
/3 = "stupid"
/4 = "unfriendly"
/5 = "unpleasant"
</item>

<item targetAlabel>
/1 = "smoking"
</item>

<item targetA>
/1 = "smoking 15a.jpg"
/2 = "smoking 16a.jpg"
/3 = "smoking 17a.jpg"
/4 = "smoking 18a.jpg"
/5 = "smoking 19a.jpg"
</item>



***********************************************************************
Performance summary
***********************************************************************

<trial summary>
/ stimulustimes = [0=summary]
/ validresponse = (" ")
/ recorddata = false
/ ontrialbegin = [values.magnitude = "little to no"]
/ ontrialbegin = [if( abs(expressions.d) > 0.15 ) values.magnitude = "a slight"]
/ ontrialbegin = [if( abs(expressions.d) > 0.35 ) values.magnitude = "a moderate"]
/ ontrialbegin = [if( abs(expressions.d) >= 0.65 ) values.magnitude = "a strong"]
/ ontrialbegin = [if(expressions.d >= 0.0) expressions.attitude = "positive"]
/ ontrialbegin = [if(expressions.d < 0.0) expressions.attitude = "negative"]
</trial>

<text summary>
/ items = ("Your IAT score (D) was <% expressions.d %>, which suggests <% values.magnitude %> <% expressions.attitude %> implicit attitude towards <% item.targetALabel.1 %>.~n~n~nPress the spacebar to complete this session.")
/ size = (60%, 60%)
/ hjustify = left
</text>

***********************************************************************
Task instruction stimuli
***********************************************************************

<trial instructions>
/ stimulustimes = [1=instructions, spacebar]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<text instructions>
/ items = instructions
/ hjustify = left
/ size = (90%, 60%)
/ position = (50%, 95%)
/ valign = bottom
/ select = sequence
/ resetinterval = 20
</text>

<item instructions>
/ 1 = "Put your left index finger on the 'E' and and your right index finger on the 'I' key of your keyboard.
Words will appear one-by-one in the middle of the screen. It is your task to categorize these words into 'positive' and 'negative'.
You see the categories 'positive' and 'negative' in the upper left and the upper right corner of your monitor.
When the word belongs to the category 'positive', press the 'E' key; when the word belongs to the category 'negative', press the 'I' key. The words belong to only one category.
If you make a mistake, an 'X' will appear - fix the mistake by hitting the other key.
This is a timed sorting task. GO AS FAST AS YOU CAN while making as few mistakes as possible.
This task will take about 5 minutes to complete."

/ 2 = "See above, a new category ('smoking') appears together with one of the previous categories you saw.
Words and pictures will now appear one-by-one in the middle of the screen.
It is again your task to categorize the words and the pictures.
Remember, each item belongs to only one group.
Categorize the words into 'positive' and 'negative' and the smoking pictures into 'smoking'.
Use the 'E' and the 'I' keys to categorize the items into three groups left and right, and correct mistakes by hitting the other key."

/ 3 = "Sort the same three categories again. Remember to go as fast as you can while making as few mistakes as possible."

/ 4 = "See above, the three categories now appear together in a new configuration. Remember, each item belongs to only one group.
Use the 'E' and the 'I' keys to categorize items into the three groups left and right, and correct mistakes by hitting the other key."

/ 5 = "Sort the same three categories again. Remember to go as fast as you can while making as few mistakes as possible."
</item>

<text spacebar>
/ items = ("Press the space bar to begin")
/ position = (50%, 95%)
/ valign = bottom
</text>

<text attributeA>
/ items = attributeA
/ fontstyle = ("Arial", 5%)
/ txcolor = (0, 255, 0)
</text>

<text attributeB>
/ items = attributeB
/ fontstyle = ("Arial", 5%)
/ txcolor = (0, 255, 0)
</text>

<picture targetA>
/ items = targetA
/ size = (40%, 40%)
</picture>

<text error>
/ position = (50%, 75%)
/ items = ("X")
/ color = (255, 0, 0)
/ fontstyle = ("Arial", 10%, true)
</text>

<text attributeAleft>
/ items = attributeAlabel
/ valign = top
/ halign = left
/ position = (5%, 5%)
/ txcolor = (0, 255, 0)
/ fontstyle = ("Arial", 5%)
</text>

<text attributeBright>
/ items = attributeBlabel
/ valign = top
/ halign = right
/ position = (95%, 5%)
/ txcolor = (0, 255, 0)
/ fontstyle = ("Arial", 5%)
</text>

<text targetAleftmixed>
/ items = targetAlabel
/ valign = top
/ halign = left
/ position = (5%, 19%)
/ fontstyle = ("Arial", 5%)
</text>

<text targetArightmixed>
/ items = targetAlabel
/ valign = top
/ halign = right
/ position = (95%, 19%)
/ fontstyle = ("Arial", 5%)
</text>

<text targetAleft>
/ items = targetAlabel
/ valign = top
/ halign = left
/ position = (5%, 5%)
/ fontstyle = ("Arial", 5%)
</text>

<text targetAright>
/ items = targetAlabel
/ valign = top
/ halign = right
/ position = (95%, 5%)
/ fontstyle = ("Arial", 5%)
</text>

<text orleft>
/ items = ("OR")
/ valign = top
/ halign = left
/ position = (5%, 12%)
/ fontstyle = ("Arial", 5%)
</text>

<text orright>
/ items = ("OR")
/ valign = top
/ halign = right
/ position = (95%, 12%)
/ fontstyle = ("Arial", 5%)
</text>

***********************************************************************
Trials
***********************************************************************

<trial attributeA>
/ validresponse = ("E", "I")
/ correctresponse = ("E")
/ stimulusframes = [1 = attributeA]
/ posttrialpause = 250
</trial>

<trial attributeB>
/ validresponse = ("E", "I")
/ correctresponse = ("I")
/ stimulusframes = [1 = attributeB]
/ posttrialpause = 250
</trial>

<trial targetAleft>
/ validresponse = ("E", "I")
/ correctresponse = ("E")
/ stimulusframes = [1 = targetA]
/ posttrialpause = 250
</trial>

<trial targetAright>
/ validresponse = ("E", "I")
/ correctresponse = ("I")
/ stimulusframes = [1 = targetA]
/ posttrialpause = 250
</trial>

***********************************************************************
Blocks
***********************************************************************

<block attributepractice>
/ bgstim = (attributeAleft, attributeBright)
/ trials = [1=instructions;2-21 = random(attributeA, attributeB)]
/ errormessage = true(error,200)
/ responsemode = correct
</block>

<block compatibletest1>
/ bgstim = (attributeAleft, orleft, targetAleftmixed, attributeBright)
/ trials = [1=instructions; 2-22 = noreplace(targetAleft, attributeA, attributeB)]
/ errormessage = true(error,200)
/ responsemode = correct
/ ontrialend = [if(block.compatibletest1.latency <= 10000 && block.compatibletest1.currenttrialnumber != 1 ) values.sum1a = values.sum1a + block.compatibletest1.latency]
/ ontrialend = [if(block.compatibletest1.latency <= 10000 && block.compatibletest1.currenttrialnumber != 1 ) values.n1a = values.n1a + 1]
/ ontrialend = [if(block.compatibletest1.latency <= 10000 && block.compatibletest1.currenttrialnumber != 1 ) values.ss1a = values.ss1a + (block.compatibletest1.latency * block.compatibletest1.latency)]
</block>

<block compatibletest2>
/ bgstim = (attributeAleft, orleft, targetAleftmixed, attributeBright)
/ trials = [1-41 = noreplace(targetAleft, attributeA, attributeB)]
/ errormessage = true(error,200)
/ responsemode = correct
/ ontrialend = [if(block.compatibletest2.latency <= 10000) values.sum1b = values.sum1b + block.compatibletest2.latency]
/ ontrialend = [if(block.compatibletest2.latency <= 10000) values.n1b = values.n1b + 1]
/ ontrialend = [if(block.compatibletest2.latency <= 10000) values.ss1b = values.ss1b + (block.compatibletest2.latency * block.compatibletest2.latency)]
</block>


<block incompatibletest1>
/ bgstim = (attributeAleft, targetARightMixed, orright, attributeBright)
/ trials = [1=instructions; 2-22 = noreplace(targetAright, attributeA, attributeB)]
/ errormessage = true(error,200)
/ responsemode = correct
/ ontrialend = [if(block.incompatibletest1.latency <= 10000 && block.incompatibletest1.currenttrialnumber != 1) values.sum2a = values.sum2a + block.incompatibletest1.latency]
/ ontrialend = [if(block.incompatibletest1.latency <= 10000 && block.incompatibletest1.currenttrialnumber != 1 ) values.n2a = values.n2a + 1]
/ ontrialend = [if(block.incompatibletest1.latency <= 10000 && block.incompatibletest1.currenttrialnumber != 1 ) values.ss2a = values.ss2a + (block.incompatibletest1.latency * block.incompatibletest1.latency)]
</block>

<block incompatibletest2>
/ bgstim = (attributeAleft, targetARightMixed, orright, attributeBright)
/ trials = [1-41 = noreplace(targetAright, attributeA, attributeB)]
/ errormessage = true(error,200)
/ responsemode = correct
/ ontrialend = [if(block.incompatibletest2.latency <= 10000) values.sum2b = values.sum2b + block.incompatibletest2.latency]
/ ontrialend = [if(block.incompatibletest2.latency <= 10000) values.n2b = values.n2b + 1]
/ ontrialend = [if(block.incompatibletest2.latency <= 10000) values.ss2b = values.ss2b + (block.incompatibletest2.latency * block.incompatibletest2.latency)]
</block>

<block compatibletestinstructions>
/ bgstim = (attributeAleft, orleft, targetAleftmixed, attributeBright)
/ trials = [1=instructions]
/ recorddata = false
</block>

<block incompatibletestinstructions>
/ bgstim = (attributeAleft, attributeBright, orright, targetArightmixed)
/ trials = [1=instructions]
/ recorddata = false
</block>

<block summary>
/ trials = [1=summary]
/ recorddata = false
</block>

***********************************************************************
Experiment
***********************************************************************

<defaults>
/ fontstyle = ("Arial", 3.5%)
/ screencolor = (0,0,0)
/ txbgcolor = (0,0,0)
/ txcolor = (255, 255, 255)
/ minimumversion = "3.0.0.0"
</defaults>

***********************************************************************
Experiment
***********************************************************************

<expt>
/ blocks = [1=attributepractice; 2=block1; 3=block3; 4=block4; 5=block5; 6=block6; 7=block7]ie
</expt>

<variables>
/ group = (1 of 2) (block1=compatibletest1; block3=compatibletestinstructions; block4=compatibletest2; block5=incompatibletest1; block6=incompatibletestinstructions; block7=incompatibletest2)
/ group = (2 of 2) (block1=incompatibletest1; block3=incompatibletestinstructions; block4=incompatibletest2; block5=compatibletest1; block6=compatibletestinstructions; block7=compatibletest2)
</variables>

***********************************************************************
Data Columns
***********************************************************************

<data>
/ columns = [date, time, subject, blockcode, blocknum, trialcode, trialnum, response, correct, latency, stimulusnumber, stimulusitem, expressions.da, expressions.db, expressions.d ]
</data>

***********************************************************************
Test Monkey
***********************************************************************
<monkey>
/ latencydistribution = normal(500, 100)
/ percentcorrect = 90
</monkey>

***********************************************************************
Scoring
***********************************************************************
<values>
/ sum1a = 0
/ sum2a = 0
/ sum1b = 0
/ sum2b = 0
/ n1a = 0
/ n2a = 0
/ n1b = 0
/ n2b = 0
/ ss1a = 0
/ ss2a = 0
/ ss1b = 0
/ ss2b = 0
/ magnitude = "unknown"
</values>

* 1 is compatible, 2 is incompatible
* a is first block, b is second block

<expressions>
/ m1a = values.sum1a / values.n1a
/ m2a = values.sum2a / values.n2a
/ m1b = values.sum1b / values.n1b
/ m2b = values.sum2b / values.n2b
/ sd1a = sqrt((values.ss1a - (values.n1a * (expressions.m1a * expressions.m1a))) / (values.n1a - 1))
/ sd2a = sqrt((values.ss2a - (values.n2a * (expressions.m2a * expressions.m2a))) / (values.n2a - 1))
/ sd1b = sqrt((values.ss1b - (values.n1b * (expressions.m1b * expressions.m1b))) / (values.n1b - 1))
/ sd2b = sqrt((values.ss2b - (values.n2b * (expressions.m2b * expressions.m2b))) / (values.n2b - 1))
/ sda = sqrt((((values.n1a - 1) * (expressions.sd1a * expressions.sd1a) + (values.n2a - 1) * (expressions.sd2a * expressions.sd2a)) + ((values.n1a + values.n2a) * ((expressions.m1a - expressions.m2a) * (expressions.m1a - expressions.m2a)) / 4) ) / (values.n1a + values.n2a - 1) )
/ sdb = sqrt((((values.n1b - 1) * (expressions.sd1b * expressions.sd1b) + (values.n2b - 1) * (expressions.sd2b * expressions.sd2b)) + ((values.n1b + values.n2b) * ((expressions.m1b - expressions.m2b) * (expressions.m1b - expressions.m2b)) / 4) ) / (values.n1b + values.n2b - 1) )
/ da = (m2a - m1a) / expressions.sda
/ db = (m2b - m1b) / expressions.sdb
/ d = (expressions.da + expressions.db) / 2
/ attitude = "unknown"
</expressions>





By Dave - 1/6/2016

#1: There is a minor mistake in the <expt> element, namely some trailing characters:

<expt>
/ blocks = [1=attributepractice; 2=block1; 3=block3; 4=block4; 5=block5; 6=block6; 7=block7]ie
</expt>

If they are also in the actual script, those should be removed.

#2: The likely cause of the error you are receiving, however,  is this: Your script is set up to expect *numerical* subject ids to do condition assignment (i.e., administer one block order vs. the other between subjects):

<variables>
/ group = (1 of 2) (block1=compatibletest1; block3=compatibletestinstructions; block4=compatibletest2; block5=incompatibletest1; block6=incompatibletestinstructions; block7=incompatibletest2)
/ group = (2 of 2) (block1=incompatibletest1; block3=incompatibletestinstructions; block4=incompatibletest2; block5=compatibletest1; block6=compatibletestinstructions; block7=compatibletest2)
</variables>

is equivalent to explicitly stating

<variables>
/ group = (1 of 2) (block1=compatibletest1; block3=compatibletestinstructions; block4=compatibletest2; block5=incompatibletest1; block6=incompatibletestinstructions; block7=incompatibletest2)
/ group = (2 of 2) (block1=incompatibletest1; block3=incompatibletestinstructions; block4=incompatibletest2; block5=compatibletest1; block6=compatibletestinstructions; block7=compatibletest2)
/ groupassignment = subjectnumber
</variables>

Normally, Qualtrics will *not* provide you with numerical ids, but *alphanumerical* subject identifiers. You can switch to a different condition assignment mode by specifying it via the /groupassignment attribute:

<variables>
/ group = (1 of 2) (block1=compatibletest1; block3=compatibletestinstructions; block4=compatibletest2; block5=incompatibletest1; block6=incompatibletestinstructions; block7=incompatibletest2)
/ group = (2 of 2) (block1=incompatibletest1; block3=incompatibletestinstructions; block4=incompatibletest2; block5=compatibletest1; block6=compatibletestinstructions; block7=compatibletest2)
/ groupassignment = groupnumber
</variables>

For details on how condition assignment works, please see https://www.millisecond.com/forums/Topic13856.aspx