I am trying to get text from div and put it in a text document using selenium c#. I cant seem to capture the text from div in variable
<div data-tid="messageContent" dir="auto"><div>new doc</div></div>
I tried these:
var puttingDataInDoc = driver.FindElement(By.XPath("//*[@data-tid='messageContent']")).GetAttribute();
var puttingDataInDoc = driver.FindElement(By.XPath("//*[@data-tid='messageContent']")).Text();
var puttingDataInDoc = driver.FindElement(By.XPath("//*[@data-tid='messageContent']")).Text;
Any suggestions please?