Question

Scenario: After clicking on the submit button,a message box appears with the ticket number. I want to save the ticket number to a string parameter for future purposes. Is it possible in Coded Ui?

Was it helpful?

Solution

Use the Assertion tool to select the textbox and name it "CaptureText()" (Do this to use the tool to capture the object). Once you've done this, transfer the code from the UIMap Designer File to the Coded File. Inside your Coded UIMap File you should see something like this:

public void CaptureText()
{
HtmlCustom uIItemCustom = this.Window.Foo.Bar.UIItem;
//Comment this out
//Assert.IsNull(uIItemCustom); 
//Change it to
var foo = uIItemCustom.InnerText;
}

Now the 'foo' variable contains the value of the label / textbox.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top