This is a migrated thread and some comments may be shown as answers.

Copy Text into Log

1 Answer 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 18 Oct 2010, 01:03 PM
Hello

I need to copy some text of a page.

I think adding the text into the log will be the easist way to store it.

I have this on the element already:

 

// Verify 'TextContent' 'Contains' '10QBECAS08103' on 'QmlblACCTRiskSummaryXIAPRefSpan'
  
Pages.MITraderApplication0.FrameAppIframe.QmlblACCTRiskSummaryXIAPRefSpan.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, "NewText");

 

 

 

 

 

I would like to copy the text out of "QmlblACCTRiskSummaryXIAPRefSpan" and place it into the log:

Log.WriteLine()

If possible I would like to create a global variable (a string) that is created at the start of the test and copy this text into that variable and then i can use that at the end of the test :)

Regards,
Tom

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 21 Oct 2010, 02:43 PM
Hello tom,

This is possible by saving the value in a initially defined variable. I've attached a sample test for reference and the code looks like this:

private string text;
 
[CodedStep(@"Persist Google input text.")]
public void WebAiiTest1_CodedStep1()
{
    this.text = Pages.Google.QText.Text;
    Log.WriteLine("current text is '" + this.text + "'");
}
 
[CodedStep(@"@\Set 'QText' text from persisted value.")]
public void WebAiiTest1_CodedStep2()
{
    Pages.Google.QText.Text = string.Concat(this.text, this.text);
    Log.WriteLine("google input text is '" + Pages.Google.QText.Text + "'");
}

Here is the log details:

Overall Result: Pass
--------------------------------------------------
'8/31/2010 4:53:54 PM' - 'Pass' : 1. Navigate to : 'http://www.google.com/'
'8/31/2010 4:53:55 PM' - 'Pass' : 2. Set 'QText' text to 'Telerik'
'8/31/2010 4:53:55 PM' - Log: current text is 'Telerik'
'8/31/2010 4:53:55 PM' - 'Pass' : 3. [WebAiiTest1_CodedStep1] : @"Persist Google input text.
'8/31/2010 4:53:55 PM' - Log: google input text is 'TelerikTelerik'
'8/31/2010 4:53:55 PM' - 'Pass' : 4. [WebAiiTest1_CodedStep2] : @"@\Set 'QText' text from persisted value.
'8/31/2010 4:53:55 PM' - 'Pass' : 5. Click 'BtnGSubmit'
'8/31/2010 4:53:57 PM' - 'Pass' : 6. Verify attribute 'value' has 'Exact' value of 'TelerikTelerik' on 'QText'
--------------------------------------------------
'8/31/2010 4:53:57 PM' - Overall Result: Pass


Greetings,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
tom
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Share this question
or