PunkoHead Posted June 19, 2017 Share Posted June 19, 2017 (edited) Hi Guys, I have a dropdown in IE with values: <option value="Chocolate"> You selected chocolate! </option> <option value="Cheese"> You selected cheese! </option> <option value="Oreo"> You selected oreo! </option> I have a simple code that is selecting the item in the dropdown per value: $user = "Cheese" $oSelectBox = _IEGetObjByName ($oIE, "food_list") _IEAction($oSelectBox, "focus") _IEFormElementOptionSelect($oSelectBox, $user, 1) What I need is to retrieve the innertext of the current selected value. So in the example above, I need it to return "You selected cheese!" in a variable $selected. How can I do this? Edited June 19, 2017 by PunkoHead Link to comment Share on other sites More sharing options...
Danp2 Posted June 19, 2017 Share Posted June 19, 2017 Try something like -- $sText = $oSelectBox.selectedOptions[0].text This assumes that there can only be one option selected at a time. PunkoHead 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
PunkoHead Posted June 20, 2017 Author Share Posted June 20, 2017 Thanks, I got it working Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now