I wrote automation script using selenium java. I want to know if it is possible to for the code to do its job even after there is some change in the website's UI.
If the code will not work after update then is there any way to write a script that works even after the website's UI is changed.
CodePudding user response:
The answer is Yes and same time answer is No.
Yes, your existing code may work depending upon:
- Unchanged locators.
- Website loading time (website performance) has not been hampered.
- Steps to execute the test methods has not been changed.
If the UI has changed, then probably chances are either
- Max chances are that locators have been changed.
- Performance, could play a role.
- There could be extra steps or a few steps have been revoked to do the same job.
CodePudding user response:
Depends on the nature and the scale of changes. Some examples:
Automation framework may still succeed on website changes if:
- If the xpath and/or css-selectors are relative locators.
- If the changes are static changes, e.g. addition/deletion of static elements.
- If the JavaScript / AJAX callback times remain unchanged.
- No additional frames are added.
Automation framework may not succeed on website changes if:
- If the xpath and/or css-selectors are absolute as in that case the indexes will change.
- If there are addition/deletion of dynamic elements.
- If the JavaScript / AJAX callback time increases and that case you would need to increase the timeouts while implementing WebDriverWait.
- If additional iframes are added you would require more switching steps.