- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我想在我的 angularJS 应用程序中测试过滤功能。事实上,当我点击过滤器时,页面上显示的搜索结果数量应该会减少到目前为止,这是我的代码:
element(by.id('foundNumber')).getText().then (function(text){console.log(text); })
element(by.repeater('term in facets.uproctype').row(0)).click ()
element(by.id('foundNumber')).getText().then (function(text){console.log(text); })
这是我的控制台日志:
Using the selenium server at http://localhost:4444/wd/hub
6209
6195
....
我不知道如何在期望行中比较这两个值,因为我不能在它们的函数中使用它们。有帮助吗?
谢谢齐德
最佳答案
我相信您必须嵌套 then 函数以确保原始值可用。
element(by.id('foundNumber')).getText().then( function(original_text) {
element(by.repeater('term in facets.uproctype').row(0)).click ();
element(by.id('foundNumber')).getText().then( function(new_text){
expect(original_text).not.toBe(new_text);
});
});
此链接也可能有帮助。 https://code.google.com/p/selenium/wiki/WebDriverJs#Control_Flows
关于javascript - Protractor : how to compare the text content of the same web element before and after clicking on a button,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21909220/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!