Entering a value in a Text Field in same row as a Selected Text Field in a Table
I am trying to select a text field that I want to enter a numeric value into. I want to select the text field by associating it with another text field. Both fields are part of the same row in a table in my declaration. What I basically want to do is select the row and then grab the entry field. Below is the scenario I have.
I have a page on the site I am testing that has security tickers and a field to enter a purchase price. The securities contained in the list can be deleted and added. I cannot select a specific field to grab the info because the security I want may not be in that position the next time I test.
A testcase I want to create is to select the row with a particular symbol (ie: MSFT). After I find that symbol I want to grab the entry field in the same row in order to enter a test value.
I am using SilkTest 6.0.2 and my Borderless Table setting is set to 1.0.
Re: Entering a value in a Text Field in same row as a Selected Text Field in a Table
So, if I'm understanding the question correctly, you have two text fields, one is populated with the value "MSFT" or some other ticker name. You'd like to identify whether or not that ticker name is currently in that field, and then manipulate the adjacent text field by entering a numeric value.
If this is indeed what you're trying to do... this is how I'd at least attempt the same thing...
First, is the text field always identifiable by some static measure, like a title of some sort? If so, you can just get the value out of it by calling GetText() method on HtmlTextField.
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">...
STRING sMyValue = "MSFT"
STRING sText = ""
sText = BrowserPage.HtmlTextField("The Static Measure|#1|$tickername".GetText()
if( (sText != "" && (sText == sMyValue) )
//put numeric value in adjacent text box</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">I hope this helps...
Then you can compare the returned value from GetText() to what you're looking for, then (hopefully) you can identify the text field next to that one that contained the value you were looking for, to enter your numeric value.