| || |
How can I select the text from a Select Object?
I'm new on e-tester, however I was doing some practices by myself and got stuck at the point that I need to select the text that I chose in a Select object from a webpage:
For example I have this code in the webpage:
<select name="Cats" size="1">
And in the webpage in the DropDown List of the Select object I selected the second option which is Tortie, so I need to save the text "Tortie" in a variable for a future usage on my testing.
In the Custom Page Programmability section of the E-tester I wrote this:
Private Sub RSWVBAPage_beforePlay()
Dim EleFromAcc As IHTMLElement
Set EleFromAcc = RSWApp.om.FindElement("fromAcct", "Select", "name")
ThisScript.FromAcc = EleFromAcc.getAttribute("outerText")
MsgBox ("The From Acct is: " + ThisScript.FromAcc)
But this source code shows me The whole list of the Select object which is "Calico Tortie Siamese", but I only need Tortie which is the one I Selected.
Please could somebody help me with this?? I really want to learn how to do it.
Re: How can I select the text from a Select Object
currently i'm not using e-tester. i used previously for 7 months.
in fact if u want to select and test one of the options , better to go with value.
and check(introduce text matching test case) for the expected static text in list box to validate the list box options.
use regular expression for the expected option in the entire static text.
hope it 'll be helpful to U