C
C#4mo ago
Grafi

Selenium C# text retrieval

Not sure where the sript fails ``` string code = "git config --global user.name  "New Sheriff in Town"\r\ngit reset $(git commit- tree HEAD^{tree} -m "Legacy code")\r\ngit push origin master --force\r\n"; private readonly By goToPastedCodeInput = By.CssSelector("a.btn.-small"); private readonly By pastedCodeInput = By.CssSelector("pre"); public string GetPastedCodeInput() { Driver.FindElement(goToPastedCodeInput).Click(); return Driver.FindElement(pastedCodeInput).Text; } string inputedCode = HomePage.GetPastedCodeInput(); Assert.IsTrue(inputedCode.Contains(code), $"Expected '{code}', but found '{inputedCode}'");
1 Reply
Omnissiah
Omnissiah4mo ago
i don't know if you forgot some escaping but this cannot possibly compile string code = "git config --global user.name "New Sheriff in Town"\r\ngit reset $(git commit-tree HEAD^{tree} -m "Legacy code")\r\ngit push origin master --force\r\n";
Want results from more Discord servers?
Add your server