This was the html code earlier for label 'Home Page' which style attribute
<label style="background: rgb(204, 136, 136); border: 2px solid red;">
<i class="fa fa-info-circle info"></i> Home Page</label>
I had written this XPath earlier which worked well
//*[contains(text(),'Home Page')]
Now I noticed html is changed for label Home Page, style attribute is removed from label as shown below
<label>
<i class="fa fa-info-circle info"></i> Home Page</label>
Because of this changes my existing XPath is not working now, but when I change XPath as shown below, it works
//label[contains(.,'Home Page')]//removed * with label, text() with dot(.)
Also when I use the previous XPath in XPath checker with * none of element is selected now but when I use second XPath with label it select the Home Page label I want.
I think both XPath should have worked, addition or removal of style attribute in label should not have any impact. Can anyone please explain why it is happening so, why my first XPath is not working now, does addition or removal of style attribute in html impact on existing XPath?
Please check the attached screenshot to view the html structure