量角器通过名称标签获取元素 [英] protractor get element by name tag

查看:94
本文介绍了量角器通过名称标签获取元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在使用量角器和Selenium Web Driver.

Currently I am working with protractor and Selenium web Driver.

我有以下问题:

我有一个html页面,我使量角器单击一个按钮.然后弹出一个窗口.该窗口包含一个名称为描述"的文本框:

I have a html page, and I make protractor clicking a button. Then a window pops up. This window contains a text box with the Name "Description":

<input type="Text" name="Description" ... />

现在,当我尝试以下操作时:

Now when I try the following:

element(by.css('[name="Description"]')).sendKeys("rabbababab");

浏览器不执行任何操作,但是量角器不会引发错误.没有文本键入到文本框中.不幸的是,该名称是唯一可识别input-TextBox的方法.

The browser does nothing, but protractor does not throw an error. No text is typed into the TextBox. Unfortunatelly, the name is the only way to identfy the input-TextBox.

我在做什么错了?

推荐答案

直接按名称选择也可以:

Selecting directly by name works as well:

element(by.name('Description')).sendKeys("rabbababab");

这篇关于量角器通过名称标签获取元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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