Q. How do I set a checkbox with a dynamic id attribute?

A. Use a regex match to populate a dynamic variable …
Example html:

<form action="test_0019.html" method="get" accept-charset="utf-8">
<input id="cblRoles_3" type="checkbox" tabindex="47" name="cblRoles:3"/>
<label for="cblRoles_3">Customer</label>
<input id="cblRoles_4" type="checkbox" tabindex="48" name="cblRoles:4"/>
<label for="cblRoles_4">Expedite</label>

Example watir:

dynamic_id = @b.html[/cblRoles_\d+>Expedite/].gsub(">Expedite","")
@b.checkbox(:id,dynamic_id).set
Social tagging: > > >

One Response to Q. How do I set a checkbox with a dynamic id attribute?

  1. Pingback: Recent Links Tagged With "checkbox" - JabberTags