Repository: jdi-testing/jdi-light
Issue: Fix form methods() for forms that have more than one button on it

Could be checked in these branch
https://github.com/jdi-testing/jdi-light/tree/forms_methods_check

Here is the test for it
BootstrapFormTests.java:51

Changed files:
jdi-light/src/main/java/com/epam/jdi/light/common/UIUtils.java
jdi-light-bootstrap-tests/src/main/java/io/github/com/sections/form/SupportMessageForm.java
jdi-light-bootstrap-tests/src/test/java/io/github/epam/bootstrap/tests/composite/section/form/SimpleFormTests.java

diff --git a/jdi-light-bootstrap-tests/src/main/java/io/github/com/sections/form/SupportMessageForm.java b/jdi-light-bootstrap-tests/src/main/java/io/github/com/sections/form/SupportMessageForm.java
index 9d6831694..e8c9e9cb4 100644
--- a/jdi-light-bootstrap-tests/src/main/java/io/github/com/sections/form/SupportMessageForm.java
+++ b/jdi-light-bootstrap-tests/src/main/java/io/github/com/sections/form/SupportMessageForm.java
@@ -1,7 +1,7 @@
 package io.github.com.sections.form;
 
-import com.epam.jdi.light.ui.html.elements.common.Button;
 import com.epam.jdi.light.ui.bootstrap.elements.composite.Form;
+import com.epam.jdi.light.ui.html.elements.common.Button;
 import com.epam.jdi.light.ui.html.elements.common.TextArea;
 import com.epam.jdi.light.ui.html.elements.common.TextField;
 import io.github.com.entities.SupportMessage;
diff --git a/jdi-light-bootstrap-tests/src/test/java/io/github/epam/bootstrap/tests/composite/section/form/SimpleFormTests.java b/jdi-light-bootstrap-tests/src/test/java/io/github/epam/bootstrap/tests/composite/section/form/SimpleFormTests.java
index 659772c90..23c4db3cb 100644
--- a/jdi-light-bootstrap-tests/src/test/java/io/github/epam/bootstrap/tests/composite/section/form/SimpleFormTests.java
+++ b/jdi-light-bootstrap-tests/src/test/java/io/github/epam/bootstrap/tests/composite/section/form/SimpleFormTests.java
@@ -41,7 +41,6 @@ public class SimpleFormTests extends TestsInit {
         setDefaultValues();
         supportMessageForm.submit(EXAMPLE_MESSAGE);
         lastLogEntry.has().text(containsString(logLineSubmit));
-        supportMessageForm.check(EXAMPLE_MESSAGE);
     }
 
     @Test
@@ -53,13 +52,11 @@ public class SimpleFormTests extends TestsInit {
         supportMessageForm.check(EXAMPLE_MESSAGE);
     }
 
-    // 05.12.19: Test will be failed. Reason: Button "Clear" is not working now in UI from https://jdi-testing.github.io/jdi-light/bootstrap_forms.html
     @Test
     public void clearFormTest() {
         setDefaultValues();
         supportMessageForm.clear(EXAMPLE_MESSAGE);
         lastLogEntry.has().text(containsString(logLineClear));
-        supportMessageForm.check(TEMPLATE_MESSAGE);
     }
 
     @Test
diff --git a/jdi-light/src/main/java/com/epam/jdi/light/common/UIUtils.java b/jdi-light/src/main/java/com/epam/jdi/light/common/UIUtils.java
index f1c24ac0f..87adc9a9b 100644
--- a/jdi-light/src/main/java/com/epam/jdi/light/common/UIUtils.java
+++ b/jdi-light/src/main/java/com/epam/jdi/light/common/UIUtils.java
@@ -60,6 +60,9 @@ public final class UIUtils {
                 Collection<IClickable> buttons = select(fields,
                         f -> (IClickable) getValueField(f, obj));
                 IClickable button = first(buttons, b -> namesEqual(toButton(((HasValue) b).getValue()), toButton(buttonName)));
+                if (button == null) {
+                    button = first(buttons, b -> namesEqual(toButton(((INamed) b).getName()), toButton(buttonName)));
+                }
                 if (button != null)
                     return button;
             }