How To Get Parent Element Text And Remove Child Element Text Selenium C#?
i'm a newbie of automation testing, now i'm using selenium C#. I have a problem, i want to get text from a element, but the code :
Text1 textdo
Solution 1:
As per the HTML you have provided to extract the text Text1 you can use the following code block:
IWebElement myElem = driver.FindElement(By.XPath("//div[@class='item-title list-friend-conctact__title has-status']"));
string myText = (string)((IJavaScriptExecutor)driver).ExecuteScript("return arguments[0].firstChild.textContent;", myElem);
Post a Comment for "How To Get Parent Element Text And Remove Child Element Text Selenium C#?"