什么是通过元素的名称在量角器选择一个元素的语法 [英] What is the syntax for selecting an element in protractor via element name

查看:105
本文介绍了什么是通过元素的名称在量角器选择一个元素的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能通过它的名称一样,你可以使用jQuery获取元素?
我想在jQuery的做jQuery选择相当于像

Is it possible to get an element by its name like you can with jQuery? I'm trying to do the equivalent of the jQuery selector like in jQuery

$('h1')

这是怎么用量角器做了什么?

how is this done with protractor?

我试过

element('h1')

,但它不工作

推荐答案

有一对夫妇方法可以做到这一点 - 你可以通过标记名或通过CSS选择器得到它。因此,任何以下工作:

There's a couple ways to do this - you can either get it by tagName or by css selector. So any of the following work:

element(by.css('h1')); // works with any css selector
$('h1'); // works with any css selector
element(by.tagName('h1'));

这篇关于什么是通过元素的名称在量角器选择一个元素的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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