I am trying to return element or text or any attribute to my test script but this is returning undefined. #3792
Unanswered
HarishSaraf
asked this question in
Help Needed
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a separate page where I am dynamically creating xpath and trying to call the same method to get the element in my test script. But this is returning 'undefined' to me. I need this to assert.
I also tried to return any attribute or gettext but still getting undefined there as well.
Code snippet -
//Page Object
getBannerLocator(this: Page, rowNum: number, colNum: number) {
this.useXpath().waitForElementVisible(
(//tr[${rowNum}]/td)[${colNum}],50000).moveToElement(
(//tr[${rowNum}]/td)[${colNum}], 0, 0).getText(
(//tr[${rowNum}]/td)[${colNum}],function(result){console.log(result.value);
}
//Test Script
console.log(this.getBannerLocator(1,3);
Beta Was this translation helpful? Give feedback.
All reactions