سؤال

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