TestStack / TestStack.Seleno

Seleno helps you write automated UI tests in the right way by implementing Page Objects and Page Components and by reading from and writing to web pages using strongly typed view models.
http://teststack.github.com/TestStack.Seleno/
MIT License
180 stars 60 forks source link

Telerik Report #251

Closed wijdench closed 7 years ago

wijdench commented 7 years ago

Hi,

Can I get the text of a Telerik report generated in a link by selenuim webdriver c#? I just want to verify in Assertion that the report contains a string, Thanks.

robdmoore commented 7 years ago

You can grab the HTML source via the Browser property on the page object or you can search for an element on the page by text too. Does that meet your needs?

wijdench commented 7 years ago

I used Find.Element(By.ClassName("s44")).Text; but it return always null,

I tried to get all the document text by js.ExecuteScript("return document.body.innerText;") or Find.Element(By.TagName("body")).Text but it return just the page head that contains the menu and not the body .

I tried also this code BrowserHost.Instance.Application.Browser.PageSource to get the page source and it returns the body without the main part wich is the report document.

I dont know how to get into the report information.

robdmoore commented 7 years ago

Is the report within an iframe?

wijdench commented 7 years ago

Yes it is.

robdmoore commented 7 years ago

In that case you'll need to target your selectors to that frame.

Check this out: http://stackoverflow.com/questions/9607964/selenium-unable-to-access-iframe-and-data-inside-it

wijdench commented 7 years ago

Thanks for your response. It helps me a lot.

robdmoore commented 7 years ago

No worries :)