From 7c95102560983feede8d11e4a63f98ef1cc8b2d2 Mon Sep 17 00:00:00 2001 From: Nikolay Mulyar Date: Mon, 5 May 2014 22:55:28 +0400 Subject: [PATCH] Should be OK. My test runner was broken --- .../java/ru/yandex/qatools/htmlelements/element/CheckBox.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/element/CheckBox.java b/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/element/CheckBox.java index d90b30f5..b514d6f2 100644 --- a/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/element/CheckBox.java +++ b/htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/element/CheckBox.java @@ -43,7 +43,7 @@ public WebElement getLabel() { if (id != null) { // Label with matching "for" attribute // Trying to find element from !ROOT! node - String xpath = String.format("//descendant-or-self::label[@for = %s]", id); + String xpath = String.format("(//label[@for = %s])[1]", id); label = findLabel(By.xpath(xpath)); } @@ -54,7 +54,7 @@ public WebElement getLabel() { if (label == null) { // Label right next to checkbox - label = findLabel(By.xpath("following-sibling::*[1][self::label]")); + label = findLabel(By.xpath("following-sibling::label")); } return label;