I have developed a Selenium script in python for a web application by extracting elements through Xpath with classname attribute. All the Xpaths are relative paths and not absolute paths. The script opens application in Chrome and works fine. But suddenly after few days, the Class name of an element changed (probably there was an update for web application, not sure). Due to this, my script is no longer able to find the element and hence failed an error.
This is a major drawback to my script drawback. I debugged it and managed to fix it by updating the classname to the present classname. But I feel it is not a proper solution as what if such changes happen again.
What happens if such a change happens again? Web application is not in my hands. I can only adjust script according to the application tag names and attribute names like class, div so on.
How could I probably handle such situations without ending up in an error? Is there a possibility that classname changes like that, if so, how would I overcome this dependancy?
I appreciate any advice on this. I can use only Python here.