For a task assigned to me I need to be able to retrieve the text from an element.
Using google's homepage as an example, I wanted to retrieve the text attached to the search button and print it on my terminal just to compare with a value later, however the attached shows error message
How can i get it to just retrieve text from an element & print it? any ideas would be much appreciate, cheers all.
var int
Given(/^User is on google$/, () => {
client.url('https://google.com')
return client.waitForElementVisible('#tsf > div:nth-child(2) > div.A8SBwf > div.FPdoLc.tfB0Bf > center > input.gNO89b')
})
When(/^User inspects button it tells me the text$/, () => {
client.getText('#tsf > div:nth-child(2) > div.A8SBwf > div.FPdoLc.tfB0Bf > center > input.gNO89b', function (result) {
int = result.value
console.log('result: '+ result)
})
return client.waitForElementVisible('#tsf > div:nth-child(2) > div.A8SBwf > div.FPdoLc.tfB0Bf > center > input.gNO89b')
})
Aucun commentaire:
Enregistrer un commentaire