Today I encountered a weird issue where in my local. I am able to retrieve element text with the help of selenium getText() method while in jenkin machine, it was giving empty value for the element text.
To fix this issue, rather then getting the text via getText() method, I used getAttribute method.
And I gave the property as "innerText".
So I replaced my getText() to getAttribute("innerText") and hurray, It returned the text now.
if this also doesn't work for you, try with below options:
1. getAttribute("innerHTML")
2. getAttribute("textContent")
This saved my lot of time because I was using scrollView method else to navigate that element first and then retrieve the text value.
No comments:
Post a Comment