john_qa Posted February 12, 2007 Share Posted February 12, 2007 Hello,I'm trying to develop a script that records the actions made in a web page and I have problems in getting the innertext of the selected option from a SELECT tag.Example source code from the Preferences page of Google:<select name=hl><option value=af>Afrikaans <option value=sq>Albanian <option value=am>Amharic.....For this code I'am trying to retriev if I select "Afrikaans" from the list, a line like this:Browser('title:=Google.....').Select('name:=hl').Set 'Afrikaans' I can't retrieve the 'Afrikaans' text, but i can retrieve the value of the option(in this case 'af')My source code looks like this:Browser('title:=$oie.document.title').Select('name:=$oElement.name').Set $oElement.value $oElement.innertext returns nothingDo you have any ideeas of how can I get the required text?Thanks Don't be afraid of tomorrow, because today is the day you were afraid yesterday. Link to comment Share on other sites More sharing options...
jvanegmond Posted February 12, 2007 Share Posted February 12, 2007 I do hope you have used $oElemt.innerText github.com/jvanegmond Link to comment Share on other sites More sharing options...
john_qa Posted February 12, 2007 Author Share Posted February 12, 2007 I do hope you have used $oElement.innerTextWell my first post contained an error: $oElement.innerText didn't returned nothing. In fact it returned the list of all options, like this: AfrikaansAlbanianAmharicArabicArmenianAzerbaijaniBasqueBelarusianBengaliBihariBork, bork, bork!BosnianBretonBulgarianCambodianCatalanChinese (Simplified)Chinese (Traditional)CorsicanCroatianCzechDanishDutchElmer FuddEnglishEsperantoEstonianFaroeseFilipinoFinnishFrenchFrisianGalicianGeorgianGermanGreekGuaraniGujarati..... Don't be afraid of tomorrow, because today is the day you were afraid yesterday. Link to comment Share on other sites More sharing options...
DaleHohm Posted February 13, 2007 Share Posted February 13, 2007 Can you use more words to explain what you are trying to do and show some example code how you are trying to accomplish it? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
john_qa Posted February 13, 2007 Author Share Posted February 13, 2007 Can you use more words to explain what you are trying to do and show some example code how you are trying to accomplish it?DaleMy script starts from another one, from this forum(I don't remember who post it, or the title of the post)..ie_events.au3 Don't be afraid of tomorrow, because today is the day you were afraid yesterday. Link to comment Share on other sites More sharing options...
DaleHohm Posted February 13, 2007 Share Posted February 13, 2007 (edited) You need the text of the selected option: $oElement.options($oElement.selectedIndex).text Dale Edit: Note, if the select object allow multiple selections, this method will only return the first item. To get multiple items you must iterate through the options collection items and check the "selected" property of each. P.S. I spent about 15 minutes downloading and pouring through your code to to figure out it's flow and about 30 seconds providing the answer. I truely would have appreciated a more focused descriiption and code snippet. Edited February 13, 2007 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
john_qa Posted February 13, 2007 Author Share Posted February 13, 2007 Thank you very much for the provided solution, and I'm sorry I wasn't able to provide focused description. Don't be afraid of tomorrow, because today is the day you were afraid yesterday. 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