我正试图从错误消息中获取文本并与预期进行比较,但它返回“0”;空”;由于don'没有正确的css路径或html
I am trying to get text from an error message and compare to the expected but it returns "null" since don't have proper css path or html id
我没有在表单中输入任何数据并试图保存它。它应该抛出一条错误消息。如何在javascript中获取错误消息的文本并进行比较我已经编写了以下代码,但它的值为null。
var errorMsg=element(by.id('alert-div'));
expect(errorMsg.getAttribute('value')).toBe('Please select the platform for the app');
它显示以下错误消息
消息:null应为"请为"应用程序"。Stacktrace:错误:预期失败
.getAttribute
是异步的,所以您必须以异步的方式使用它。
var errorMsg = element(by.id('alert-div'));
errorMsg.getAttribute('value'))
.then(function (value) {
expect(value).toBe('Please select the platform for the app');
})
相关文章:
- 元素在我的代码中不会.fadeTo.Don'I don’我不知道;s错误的JavaScript、JQuery、H
- 由于iframe导致的问题
- Don'不允许将焦点集中在自动完成的选择上
- javascript如果图像不存在don't加载它
- append元素don'不要在提交时出现
- AngularJS指令部分应用的函数don'不起作用
- 由于响应中不存在“Access Control Allow Origin”标头,跨域请求停止工作
- Don'我不明白为什么我的setInterval+jQuery;不起作用
- 我没有'I don’我不理解for在循环中的用途
- jQuery 1.7.2:.on()在一个页面上工作;Don’别再干别的了
- AngularJs|Don'在成功加载所有指令htmls之前,不显示页面
- Codeacademy Javascript..好的!/输出正确,但codeacademy没有;I don’我不喜欢
- Don't工作警报代码jQuery
- 由于某种原因,JavaScript整数存储为未定义
- 摩卡由于绝对路径而不断轰炸
- 由于滑块的原因,光标始终是D3中的十字光标
- 由于某种原因,我的JavaScript函数无法工作
- 如何实施“;Don'不要再给我看了”;在GWT中
- 链接don'由于Javascript悬停效果,无法在移动设备上工作
- 我正试图从错误消息中获取文本并与预期进行比较,但它返回“0”;空”;由于don'没有正确的css路径或html