从 elementFinder 中取回 webdriver.Locator [英] Get back the webdriver.Locator out of an elementFinder

查看:38
本文介绍了从 elementFinder 中取回 webdriver.Locator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于我有 elmFinder 变量:

var elmFinder = element(by.css('.thing'));

如果我需要取回 webdriver.Locator,又名定位器策略怎么办?即

What if i need to get back the webdriver.Locator, a.k.a locator strategy? i.e.

elmFinder.??? //=> by.css('.thing')

我正在处理 ??? 函数(如果存在).

I'm looking after the function ??? if it exists.

更新:

此功能已合并,我们现在可以:

This feature has been merged and we can now do:

elmFinder.locator();

推荐答案

更新:

此功能已合并,我们现在可以:

This feature has been merged and we can now do:

elmFinder.locator();

旧答案:你不能.元素查找器不保留对定位器的引用:

Old answer: You cannot. The element finder does not keep a reference to the locator:

https://github.com/angular/protractor/blob/master/lib/protractor.js#L103

这篇关于从 elementFinder 中取回 webdriver.Locator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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