So I want to click on the Cancel button in my application but after getting the xpath I noticed that there was an embedded number in the id field. This number changes every time that my application is run. Since the xpath will change every time due to this embedded number how do I identify the object so I can click on it. Examples are as follows I run the application and use spy Web to get the xpath the xpath is: id(“komet_concept_save_section_1954332595015415”)/button[@class=“btn btn-default”]. The next time I run the application my xpath is this: //*[@id=“komet_concept_save_section_1955370716785905”]/button. As you can see the number has changed. How do I click on the button.
I’m pretty confident to say that your ‘Cancel’ button have dynamic attributes and you have to handle this case using ‘contains’ condition for ‘id’ attribute instead of ‘equals’ now.