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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top