rundak Posted May 1 Posted May 1 Hello, I need some help with React-select dropdown list? How to interact with it? All option are hidden. Example: How to choose "Silver" from single value list on this page https://react-select.com/home using WebDriver (may be WD_ExecuteScript)? I can only click on this using code, no idea how to choose 'Silver' without clicking. Local $website_link = 'https://react-select.com/home' $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, $website_link) $list = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='react-select-3-input']") _WD_ElementAction($sSession, $list, 'click') _WD_ElementAction($sSession, $list, 'value', 'Silver') doesn't work Any idea how to do it in the easiest direct way? May be there is possibility to choose it somehow with WD_ExecuteScript? I have already tried some instruction but no success. _WD_ExecuteScript($sSession, "arguments[0].scrollIntoView();", "//input[@aria-activedescendant='react-select-3-option-9']") Thank you for your help.
Nine Posted May 1 Posted May 1 When you post code, please use the method shown in the link. Here one way : $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='react-select-3-input']") _WD_ElementAction($sSession, $sElement, 'value', "Silver") Local $sAction = '{"actions":[{"type":"key","id":"keyboard_1","actions":[{"type":"keyDown","value":"\uE007"},{"type":"keyUp","value":"\uE007"}]}]}' _WD_Action($sSession, "actions", $sAction) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
rundak Posted May 1 Author Posted May 1 (edited) Sorry. It works and it is enough for me. Thank you for your help. Edited May 1 by rundak
Danp2 Posted May 1 Posted May 1 FWIW, there are several functions included in wd_helper.au3 for interacting with Select elements -- _WD_ElementOptionSelect _WD_ElementSelectAction Latest Webdriver UDF Release Webdriver Wiki FAQs
Nine Posted May 2 Posted May 2 @Danp2 React-select is quite a different beast. It won't work with standard option select functions. Maybe you could enlighten us how it could be done more elegantly... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
SOLVE-SMART Posted May 2 Posted May 2 (edited) Hi folks 👋 , as @Nine already mentioned, React components are quite different. Even for really simple HTML5 things like a dropdown (select > option) that is straight forward and standardized, React (also other frameworks like Angular and so on) come up with a own variant of dealing with such user interactions 🥴 . Anyhow, I usually debug (Event Listeners Breakpoints) the website with the Chrome DevTools to get the hidden or unreachable "list" (select > option). Then you can simply look for your (option-) selector and do a second click. See this example: _Main() Func _Main() Local Const $sUrl = 'https://react-select.com/home' _WD_Navigate($sSession, $sUrl) Local Const $sDropdownSelector = '//input[@id="react-select-3-input"]' _ClickElement($sDropdownSelector) Local Const $sOption = 'Silver' Local Const $sOptionSelector = StringFormat('//div[contains(@id, "react-select-3-option") and text()="%s"]', $sOption) _ClickElement($sOptionSelector) EndFunc Func _ClickElement($sSelector) Local Const $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sSelector) _WD_ElementAction($sSession, $sElement, 'click') EndFunc You also might noticed the @id structure of the dropdown: The input element, first click, and the option element (which is a div), second click, do have this react-select-3-* prefix which is common for this kind of react component. So you can assume to "simply" change input by option (the suffix) and you will get your element. This depends on the developer (team) who creates the website, but as I said, I saw it many times in that way structured. @Nine this is not a more elegant way, but maybe a more straight forward one. This been said, I really like your low level _WD_Actions variant, because it can be used in other scenarios as well 🤝 . Best regards Sven Edited May 2 by SOLVE-SMART Nine 1 ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
mLipok Posted May 2 Posted May 2 (edited) Pleaae look here: https://react-select.com/home Which one (select element) is most comparable to your case. Edited May 2 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
SOLVE-SMART Posted May 2 Posted May 2 (edited) Do you ask me @mLipok or the OP who referred to the website himself? I am a bit confused 🤭 . My code example above fits the first dropdown (select) element. Best regards Sven Edited May 2 by SOLVE-SMART ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
Nine Posted May 2 Posted May 2 (edited) 8 hours ago, SOLVE-SMART said: I usually debug (Event Listeners Breakpoints) the website with the Chrome DevTools to get the hidden or unreachable "list" Interesting. Not familiar with this, mind sharing how to perform it ? nvm, found it, thanks for giving us a good way to find hidden nodes. Edited May 2 by Nine SOLVE-SMART 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
SOLVE-SMART Posted May 2 Posted May 2 (edited) On 5/2/2025 at 3:32 PM, Nine said: Interesting. Not familiar with this, mind sharing how to perform it ? nvm, found it, thanks for giving us a good way to find hidden nodes. Ohh, you are too quick and too smart unfortunately - I already created a how-to video that I will upload and share, but now you already solved it on your own 😆 . Maybe for others this could help. Video link coming soon ... Best regards Sven Edited May 3 by SOLVE-SMART Nine 1 ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
mLipok Posted May 2 Posted May 2 5 hours ago, SOLVE-SMART said: Do you ask me @mLipok or the OP who referred to the website himself? OP Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
SOLVE-SMART Posted May 3 Posted May 3 (edited) On 5/2/2025 at 5:52 PM, SOLVE-SMART said: [...] I already created a how-to video that I will upload and share, [...] Maybe for others this could help. Video link coming soon ... Here is the announced video, a little how-to one: 💡 Maybe I create few more videos like this for XPath usage and determination. I guess also for more JavaScript debugging (in the browser) etc. Time will show. Spoiler In case I will create more videos like this, they can be found in this youtube playlist: https://www.youtube.com/playlist?list=PLDoYN-7Uor1BU4GY5qui1XKVSl4udGI36 Best regards Sven 👉 Btw: Forgive me, my spoken english is a bit rusty (as non native speaker). But for one take 🎬 only, it's not too bad (I hope so). Edited May 3 by SOLVE-SMART mLipok, ioa747, Nine and 1 other 3 1 ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
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