-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Hello, this is Capybara 3.40 running in Selenium. I've got some markup like this:
<input type="checkbox" name="audit[questions][chaussures-lacets][criteria][]" id="audit_q0_c0" value="yes" />
<label for="audit_q0_c0">Le lacet gauche est attaché au lacet droit</label>
But when I try to check("Le lacet gauche est attaché au lacet droit")
I get
Ambiguous match, found 2 elements matching visible checkbox "Le lacet gauche est attaché au lacet droit" that is not disabled (Capybara::Ambiguous)
Now here's a debugger-REPL to explore the markup together. The page contains 4 checkboxes, but the others have different labels and different for/id
attributes:
(rdbg) page.config.automatic_label_click
true
(rdbg) page.body.lines.grep /type=\"checkbox\"/
["<input type=\"checkbox\" name=\"audit[questions][chaussures-lacets][criteria][]\" id=\"audit_q0_c0\" value=\"yes\" />\n",
"<input type=\"checkbox\" name=\"audit[questions][chaussettes-pareilles][criteria][]\" id=\"audit_q0_c0\" value=\"yes\" />\n",
"<input type=\"checkbox\" name=\"audit[questions][chaussettes-pareilles][criteria][]\" id=\"audit_q0_c1\" value=\"yes\" />\n",
"<input type=\"checkbox\" name=\"audit[questions][chaussettes-pareilles][criteria][]\" id=\"audit_q0_c2\" value=\"yes\" />\n"]
(rdbg) page.body.lines.grep /<label/
["<label for=\"audit_q0_c0\">Le lacet gauche est attaché au lacet droit</label>\n",
"<label for=\"audit_q0_c0\">J'ai une chaussette sur mon pied gauche</label>\n",
"<label for=\"audit_q0_c1\">J'ai une chaussette sur mon pied droit</label>\n",
"<label for=\"audit_q0_c2\">Les deux chaussettes sont de la même famille</label>\n"]
(rdbg) page.check("Le lacet gauche est attaché au lacet droit")
eval error: Ambiguous match, found 2 elements matching visible checkbox "Le lacet gauche est attaché au lacet droit" that is not disabled
Can you help me figure out what I'm doing wrong?
Metadata
Metadata
Assignees
Labels
No labels