I’m trying to submit a simple form that has an array of fields:
<form>
<input type='text' name='Article[]' id='Article1' />
<input type='text' name='Article[]' id='Article2' />
<input type='text' name='Article[]' id='Article3' />
So, how do I set the different fields using SimpleTest?
(p.s. I’ve seen this question: Simpletest PHP scriptable browser… how to test submit a form that has [ ] in the form name (basically in array format)? but it doesn’t answer my question).
I figured out one way of doing this is to use setFieldById. Change the code to:
And so on. Works perfectly but assumes you can generate unique IDs for each field — not that difficult.