From 92a05170521d3baf3655d6bc99220e8a6a1bcfc7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 May 2018 14:44:44 -0300 Subject: [PATCH] Bug 19185: Use submit button if only one exists on the page During the installation process we do not have fieldset.action, in order to not complicate changes we are just going to use the submit button if only one exists. Signed-off-by: Martin Renvoize --- t/lib/Selenium.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm index b5b1374485..c06fa48c11 100644 --- a/t/lib/Selenium.pm +++ b/t/lib/Selenium.pm @@ -116,6 +116,13 @@ sub fill_form { sub submit_form { my ( $self ) = @_; + # If there is only one submit element on the page we use it + my @submit_elements = $self->driver->find_elements('//input[@type="submit"]'); + if ( @submit_elements == 1 ) { + $self->click_when_visible('//input[@type="submit"]'); + return; + } + my $default_submit_selector = '//fieldset[@class="action"]/input[@type="submit"]'; $self->click_when_visible( $default_submit_selector ); } -- 2.19.1