[英]Error: function timed out, ensure the promise resolves within - Cucumber js
I am using protractor with cucumber js i have all function with async and await and also set global timeout我正在使用 protractor 和 cucumber js 我有所有 function 与异步和等待,还设置全局超时
var {setDefaultTimeout} = require('cucumber'); var {setDefaultTimeout} = 要求('黄瓜'); setDefaultTimeout(60 * 1000);
设置默认超时(60 * 1000);
Then('I click on tab', async ()=> {
await organizationOperation.clickHeaderTab();
});
Question - if i use wrong xpath/element is not located in UI, in that case getting below error问题 - 如果我使用错误的 xpath/element 不在 UI 中,在这种情况下会出现错误
Error: function timed out, ensure the promise resolves within 60000 milliseconds错误:function 超时,确保 promise 在 60000 毫秒内解析
It should throw an error locator not found (locator text)它应该抛出一个找不到错误定位器(定位器文本)
or if directly i use或者如果我直接使用
Then('I click on tab', async ()=> {
const d = await $('.xxxxx').getText();
console.log(d)
});
getting same error --> Error: function timed out, ensure the promise resolves within 30000 milliseconds得到同样的错误 --> 错误:function 超时,确保 promise 在 30000 毫秒内解决
Why it is not showing - element not found error on console..?为什么它没有显示 - 在控制台上找不到元素错误..?
Are you using implicit wait in your code while launching a browser?您是否在启动浏览器时在代码中使用了隐式等待? If Yes, make sure your timeout is more than implicit wait time you provided.. If not, declare implicit wait time with less than the default setDefaultTimeout(60 * 1000);
如果是,请确保您的超时时间大于您提供的隐式等待时间。如果不是,请声明隐式等待时间小于默认的 setDefaultTimeout(60 * 1000);
In case implicit wait is more than default time, we used to get this error function timed out, make sure to resolve with in ****.如果隐式等待超过默认时间,我们曾经收到此错误 function 超时,请确保使用 **** 解决。 In case implicit wait is less than the default time, waiting for an element via implicit wait will expire first and throws Element Not Found exception.
如果隐式等待小于默认时间,则通过隐式等待等待元素将首先过期并抛出 Element Not Found 异常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.