Explanation : When there is no such attribute as disabled in element, the isEnabled() method from selenium does not work.
Solution : There is some attribute which makes the element to be disabled so we have to find the element and get the attribute using getAttribute() method then compare what is the value for enabled and disabled. BAsed on this we can conclude whether the element is enabled or not.
Yes, we can automate the captcha but there is a limitation that we can automate our own captcha but not others'
For example, a company has captcha in their website, so somebody has to check it but same time it is not possible for manual tester to check all the captcha's.
So we have to automate the captcha in dev/qa environment by getting the captcha answer in some attribute of the element, so based on that attribute we can enter the value to the text bar which accepts captcha value.
We should remove this attribute while pushing the code to Live environment.
There are couple of things which may cause this issue.
Example : Consider you have a element which has xpath as //button[@id='abc'] on page X, by clicking some tab on xpage navigates the user to Y page, Now there is an element on Y page which have xpath same as //button[@id='abc'].
But when you launch your application, application may be directly landed on page Y. So with this scenario, if you try to perform on element on Y page it could throw an Exception.
Step by step Solution :
Program 1 : Using Explicit wait (Wait for the element to be visible):
Program 2 : Using findElements And IsDisplayed:
Most of the time implicit wait will not work with findElements but only when there is no element for the given locator then only implicit wait works from findElements.
Article is written by Pavan (a) KarthiQ. Well, I am serving notice period in an MNC, Bangalore. I thought to enrich every person knowledge a little, I always have a feeling, when we teach something, we will learn more than what you know.
Knowledge is the only thing that doubles when you spend it.
I have also created the reporter for Protractor Jasmine. Use for your projects without any hesitation