This question already has an answer here:
New to Automation , I am using selenium with JAVA.
I have come across a stumbling block our developers do not assign ID to our elements and JFS assigns it own ID , however the ID's are dynamic and keeps on changing.
Also the xpaths and css selectors also contains the dynamic id's.
I have seem some methods of using contains , starts with , however cannot seems to get it correct , when I inspect my element I get below
<button type="button" class="ui-datepicker-trigger ui-button ui-widget ui- state-default ui-corner-all ui-button-icon-only" aria-label="Show Calendar" aria-haspopup="true" role="button" aria-disabled="false"><span class="ui- button-icon-left ui-icon ui-icon-calendar"></span><span class="ui-button- text">ui-button</span></button> xpath - //[@id="j_idt67:j_idt69:j_idt70:j_idt100:j_idt101:calendar"]/button css selector = #j_idt67\3a j_idt69\3a j_idt70\3a j_idt100\3a j_idt101\3a calendar > button
I f anyone could assist and advise on how you would locate the element and insure that it would not change , would be of great assistance , if you require further info , let me know , like I said new to automation