Watir-Webdriver - 无法找到带有 id、名称、文本、值的按钮 [英] Watir-Webdriver - Unable to locate a button with id, name, text, value

查看:19
本文介绍了Watir-Webdriver - 无法找到带有 id、名称、文本、值的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对网络自动化和 watir-webdriver 非常陌生.我正在尝试一个脚本来启动网络并提交登录表单.我能够用id"标签识别用户名和密码文本字段.但登录按钮没有任何 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.

这是标识按钮的页面的 HTML 的一部分

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>

推荐答案

如果不查看整个页面,很难判断按钮的独特之处.但是,假设只有一个登录按钮,您可能可以这样做:

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

这篇关于Watir-Webdriver - 无法找到带有 id、名称、文本、值的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆