I have to check if a change was done in the inner text of an area on my website.
Lets assume this to be the html of such page:
<span _ngcontent-c1="" class="image"> <span _ngcontent-c1="" style="font-weight: 700">test</span> "Question" <sup _ngcontent-c1="" class="supR">®</sup></span>
I have this to find the element:
IWebElement testText= driver.FindElement(By.Class("image")).Text;
After clicking on an item in the page, the inner text "Question" changes to "Answer", for example.
What is the best way to check the change? Create a new IWebElement and compare it (with an assertion) to the first one? This is the only way I know. Although, I would like to know if there is a better way. Because in case the inner Text changes with other actions, I don't think creating a new IWebElement every time to check if the change was made.