0

I would like to click on label corresponding to checkbox using mink php code. The code look like this:

<label class="label" for="somecheckbox_Id"> heylabel
 </label>

I can parse the checkbox for manipulation, can't parse the label. To parse the checkbox I did it like this

$doc= $this->getSession()->getPage()->find('css','#somecheckbox_Id'); 

how can I access the corresponding label?

eskoba
  • 532
  • 1
  • 7
  • 25

1 Answers1

1

Labels should always have a "for" attribute pointing to the checkbox in question. So, simply use

$page->find('css', 'label[for='+name+']');
Alexander Reifinger
  • 512
  • 1
  • 4
  • 18