From 69f851a002307e7245f901b23582708a855ec66b Mon Sep 17 00:00:00 2001
From: Gabriel Marinkovic <gabrielmarink@gmail.com>
Date: Sun, 22 Sep 2019 17:36:20 +0200
Subject: [PATCH] fixed bug where ExistsBySelector() would look at element's
 parents instead of children.

---
 pkg/drivers/http/element.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/drivers/http/element.go b/pkg/drivers/http/element.go
index a2e69322..710874f0 100644
--- a/pkg/drivers/http/element.go
+++ b/pkg/drivers/http/element.go
@@ -468,9 +468,9 @@ func (el *HTMLElement) CountBySelector(_ context.Context, selector values.String
 }
 
 func (el *HTMLElement) ExistsBySelector(_ context.Context, selector values.String) (values.Boolean, error) {
-	selection := el.selection.Closest(selector.String())
+	selection := el.selection.Find(selector.String())
 
-	if selection == nil || selection.Length() == 0 {
+	if selection.Length() == 0 {
 		return values.False, nil
 	}