在自动化测试中如何在Nightwatch中单击禁用的元素链接

时间:2017-06-21 14:25:33

标签: javascript automated-tests nodes nightwatch.js

请考虑以下图片: enter image description here

  • 1。)已禁用元素:第一个箭头指向已禁用(非活动)列表元素;
  • 2。)问题:第二个水平箭头指向加号(+),我要点击;
  • 3。)但正如您在浏览器控制台中看到的那样,加号(+)为disabled

问题描述:

首先,我选择非活动表中的元素,然后点击其加号图标

代码:

var reactivate_categoryStatus = function() {
describe("", function() {
    it("reactivate category", function(browser) {
        variables.createdActivityCategoryName = 'testCategory_2017Apr19184658';
        browser.pause(2000);
        commands.checkAndPerform('click', browser, elements.adminRelationshipManagementPageElements.activityStatusInactiveLink);
        browser.pause(2000);
        browser.elements("xpath", elements.adminRelationshipManagementPageElements.activityStatusInactiveTable + "/tbody/tr", function(result) {
            var els = result.value;
            var count = 0;
            els.forEach(function() {
                count = count + 1;
                browser.getValue(elements.adminRelationshipManagementPageElements.activityStatusInactiveTable + "/tbody/tr[" + count + "]/td[1]/input", function(result) {
                    // console.log(" >>>>>>>>>>>>>>Create name Of status activity "+variables.createdActivityCategoryStatusName);
                    if (result.value.includes(variables.createdActivityCategoryStatusName)) {
                        console.log('inactive name to reactivate : ' + result.value);
                        console.log(" >>>>>>>>>>>>>>    if con status activity " + variables.createdActivityCategoryStatusName);
                        commands.checkAndPerform('click', browser, elements.adminRelationshipManagementPageElements.activityStatusInactiveTable + "/tbody/tr[" + count + "]/td[2]/span");
                    }
                });
            });
        });
        browser.pause(2000);
    });
});
};
exports.reactivate_categoryStatus = reactivate_categoryStatus;

0 个答案:

没有答案