失败:无法读取未定义的属性“getWebElements" [英] Failed: Cannot read property 'getWebElements' of undefined

查看:50
本文介绍了失败:无法读取未定义的属性“getWebElements"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是量角器测试的新手.似乎缺少 getWebelement.我的保护程序的版本是 3.0.0.另一个属性很好(例如点击、评估...)

I am new to protractor test. it seems getWebelement is missing. the version of my protector is 3.0.0. another properties are fine (such as click, evaluate ...)

browser.wait(element(by.id('some-element')).getWebElement);

browser.wait(element(by.id('some-element')).isPresent);

(c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\lib\element.js:754:36)在 c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:720:12在 goog.async.run.processWorkQueue (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)在 process._tickCallback (node.js:368:9)来自: 任务:在新的wrappedCtr (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:2468:26)在 goog.async.run.processWorkQueue (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15)在 process._tickCallback (node.js:368:9)来自: 任务:在 [object Object].webdriver.WebDriver.wait (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:716:21)在 [object Object].to.(anonymous function) [as wait] (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:65:25)在对象.(c:\Users\xxx\WebstormProjects\pt\spec.js:45:21)在 c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:96:23在新的wrappedCtr (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:2468:26)在 controlFlowExecute (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:82:18)来自:任务:在控制流中运行它(未知")在对象.(c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:81:14)at tryAsync (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1819:24)在 QueueRunner.run (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1774:9)在 QueueRunner.execute (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1762:10)

(c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\lib\element.js:754:36) at c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:720:12 at goog.async.run.processWorkQueue (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15) at process._tickCallback (node.js:368:9) From: Task: at new wrappedCtr (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:2468:26) at goog.async.run.processWorkQueue (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:124:15) at process._tickCallback (node.js:368:9) From: Task: at [object Object].webdriver.WebDriver.wait (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:716:21) at [object Object].to.(anonymous function) [as wait] (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:65:25) at Object. (c:\Users\xxx\WebstormProjects\pt\spec.js:45:21) at c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:96:23 at new wrappedCtr (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:2468:26) at controlFlowExecute (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:82:18) From: Task: Run it("unknown") in control flow at Object. (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:81:14) at attemptAsync (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1819:24) at QueueRunner.run (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1774:9) at QueueRunner.execute (c:\Users\xxx\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1762:10)

推荐答案

browser.wait(element(by.id('some-element')).isPresent());

您在 isPresent 之后缺少括号...

you are missing the parenthesis after isPresent...

然后在 getWebElement...

and after getWebElement...

browser.wait(element(by.id('some-element')).getWebElement());

这篇关于失败:无法读取未定义的属性“getWebElements"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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