var demoServicesFunctions={
getDemoTabText:function(){
var fieldVal;
this.getText('@demoTab', function(result){
fieldVal=result.value;
fieldVal=fieldVal.trim();
});
return fieldVal;
}
}
module.exports={commands:[demoServicesFunctions],elements:{demoTab:{
selector:"//a/span[text()='demo']",locateStrategy:"xpath"
},}};demotest.jsvar demoServicesPage;module.exports={before: function(browser){browser.url(browser.launch_url);
browser.pause(2000);
demoServicesPage=browser.page.demopage();
},after : function(browser){browser.end();
},"Verify Demo services : function(client) {
var textVal=demoServicesPage.getDemoTabText();
console.log("The text is :"+textVal); //the textVal is always showing as undefined.
}
}}Thanks,Santosh
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/4947a429-d811-46e4-8c6f-1e5dd440b42b%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "NightwatchJs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nightwatchjs/iUDgdCjD1CU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/38be00d1-51e9-4f44-813e-f3cddae813f9%40googlegroups.com.
module.exports = {
'Demo Google search test without promises' : function (client) {
var homePage = client.page.googleSearchPageObj();
homePage
.navigate()
.waitForElementVisible('@searchBar',5000)
.waitForElementVisible(‘@submit_button’,1000)
.setValue('@searchBar', 'Flowers')
.click(‘@submit_button’)
.waitForElementVisible(‘@results’,5000)
.waitForElementVisible(‘@web’,1000)
.waitForElementVisible(‘@support’,1000)
.waitForElementVisible(‘@images’,1000)
.verify.textContains(‘@results’,’Flowers’);
client.end();
}
};
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/CAM7-OkMOyF_7N6rhpAMAbdOy7r5QvnWH-FEVXfi7ejCs9%2Byniw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/CAPh5BNxwaefe99J%3D0BmOvvQKQnpzccnOurviGVHHP83O0BFk4A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/CAM7-OkMGL5hbixcrKvR2xYKVQCetXVCG4DsQVTftwVBPVZWVpA%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "NightwatchJs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nightwatchjs/iUDgdCjD1CU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/f0bb8f1f-0bdd-4fb7-87c3-bb6afde7786b%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to nightwatchjs...@googlegroups.com.
module.exports = {
elements: {
myElement: 'div.myElementSelector',
linkToAnotherPage: 'a.linkToAnotherPage'
},
commands: {
getElementTextFromPage: function(callback) {
return this.waitForElementPresent('@myElement')
.getText('@myElement', function(result){
callback(result.value);
});
},
navigateToAnotherPage: function() {
this.getAttribute("@lintToAnotherPage", "href", function (link) {
this.url(link.value);
});
return this.api.page.anotherPage();
}
}
};var pageUnderTest;
module.exports = {
'tags': ['experiment'],
before: function(client) {
//stuff to initialize page
pageUnderTest = client.page.myPage();
},
after: client => client.end(),
'Get value from page': (client) => {
var textToUse;
pageUnderTest
.getElementTextFromPage(function(textFromPage) {
textToUse = textFromPage;
})
.NavigateToAnotherPage()
.containsText(textToUse); // command exists within page object for anotherPage.js
}
};To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/ca7bbe70-03ff-4a5f-9874-04694ec98b67%40googlegroups.com.
OK. 14 assertions passed. (108.4s)
To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/30d624b0-dce3-4494-a361-5f6a7192ac3e%40googlegroups.com.
waitForElementVisible('<input[id="q"]>',5000) waitForElementVisible('<input[id="q"]>',5000,'Search button was visible in less than 5 seconds').To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/995fb0b2-3d64-4f44-881d-2f7df98deebd%40googlegroups.com.
To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/995fb0b2-3d64-4f44-881d-2f7df98deebd%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/CAPh5BNyFi%2BpHV89x%2B0kAA%3DVEAPdKfGxsinfUD3bJQZZDEeU0ig%40mail.gmail.com.