This answer relates to how to manipulate the brother element, which, it seems to me, relates to the original question, relates to
Your question hypothesis works with a minor tweak. If a dynamically generated field looks like this and does not have an identifier:
<div> <input></input> <button>Test</button> </div>
Then your request:
find('button', text: 'Test').find(:xpath, "..").find('input').set('whatever')
If dynamically generated input is connected using the id element (be careful with them, as in angular, they usually change depending on adding and removing elements), it will be something like this:
find('button', text: 'Test').find(:xpath, "..").fill_in('#input_1', with: 'whatever')
Hope this helps.
T. Slater Mar 08 '16 at 20:35 2016-03-08 20:35
source share