0

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.

  • 1
    That cannot be answered and all completely depends on the website and how you navigate the website. eG If every element has a unique `id` and you only use those to find elements than any change on the Website that does not change those ids will not have an effect. If you can only work with stuff like XPATH or CSS Selectors to select your elements than pretty much every change that changes the CSS or XPATH will mean your old methods won't work anymore etc. pp. There is neither a general answer we can give you here nor a special secret tactic that will work always regargless of changes. – OH GOD SPIDERS Nov 15 '21 at 16:15

2 Answers2

0

The answer is Yes and same time answer is No.

Yes, your existing code may work depending upon:

  1. Unchanged locators.
  2. Website loading time (website performance) has not been hampered.
  3. Steps to execute the test methods has not been changed.

If the UI has changed, then probably chances are either

  1. Max chances are that locators have been changed.
  2. Performance, could play a role.
  3. There could be extra steps or a few steps have been revoked to do the same job.
cruisepandey
  • 28,520
  • 6
  • 20
  • 38
0

Depends on the nature and the scale of changes. Some examples:

Automation framework may still succeed on website changes if:

  • If the and/or 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 and/or 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.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352