mmar
mmar

Reputation: 2030

Watir-Webdriver - Unable to locate a button with id, name, text, value

I am very new to web automation and watir-webdriver. i am trying a script to launch a web and submit the login form. I was able to identify the username and password text fields with the 'id' tag. but the login button doesn't have any of the id, name, text and value keys. i have tried looking all the sources, they all have atleast any one key to search the button. but as i am not seeing that in my web application, could someone help me how to search the button and click it.

Here's a portion of the HTML from the page where the button is identified

<jl-button-bar class="margin-bottom centered ng-scope">
  <button class="primary full jl-button ng-scope" type="submit" tabindex="0">
    <ng-transclude>
      <span class="ng-scope">Login</span>
    </ng-transclude>
  </button>
</jl-button-bar>

Upvotes: 0

Views: 637

Answers (1)

Justin Ko
Justin Ko

Reputation: 46846

It is hard to tell what is unique about the button without seeing the entire page. However, assuming there is only one login button, you can probably do:

browser.button(text: 'Login').click

If the application supports multiple languages, you might not want to use the text. If there is only the login form, you can probably do:

browser.button(type: 'submit').click

Upvotes: 2

Related Questions