Search code examples
c#selenium-webdriverspecflow

SpecFlow & Selenium - Unable to assert title of Apple SSO


I noticed that in Apple SSO, there is an   in title due to which when I assert for title to be Sign in with Apple it always fails because of   I have tried regex replace but it doesn't work.

The failure says following: expected actual result to be "Sign in with Apple ID", but "Sign in with Apple ID" differs near " ID" (index 18)

Any help would be greatly appreciated on how I can solve this conundrum

Bitbucket Login Page


Solution

  • May be you have an invisible character that may have a Unicode representation. You can try replacing the invisible character with its Unicode representation in your expected title string. For example, if the invisible character is a non-breaking space, you can replace it with "\u00A0".

    Another solution is to iterate over each character in the expected and actual titles and compare them individually. This way, you can identify the specific position, in your case index 18, where the titles differ due to the invisible character. Once you find the differing character, you can handle it accordingly, such as ignoring it or replacing it before making the comparison.