This will work on c#.
driver.FindElement(By.CssSelector("body")).SendKeys(OpenQA.Selenium.Keys.Control + "a");
driver.FindElement(By.CssSelector("body")).SendKeys(OpenQA.Selenium.Keys.Control + "c");
var txt = Clipboard.GetText();
I like this better then GetText()driver.FindElement(By.CssSelector("body")).Text
, because gettextText
returns all kinds of extra chars, this returns clean text. Works especialy well with tables returning tab delimted rows that can easily be pasted into excel.