mustilem23 Posted Tuesday at 11:33 AM Posted Tuesday at 11:33 AM (edited) I'm trying to use ControlSetText in AutoIt to input text into the "Name" and "Fuzzy Name" fields on this web page: 👉 https://www.trade.gov/data-visualization/csl-search However, it doesn't seem to work. I suspect it's because the page uses modern web technologies (JavaScript-based elements), and maybe ControlSetText can't interact with them properly. I tried inspecting the elements and using their IDs, but I'm still stuck. I'm very new to this, so I'd really appreciate any help or guidance. Here's the code I'm working with: <input type="text" class="explorer__form__input" id="name" name="name" value=""> <input type="text" class="explorer__form__input" id="name" name="name" value=""> #include <AutoItConstants.au3> ; Open the browser and navigate to the URL Run("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe https://www.trade.gov/data-visualization/csl-search") WinWaitActive("CSL Search") ; Wait for the window title Sleep(5000) ; Try to set the text in the "Name" field ControlSetText("CSL Search", "CSL Search - International Trade Administration", "name", "Kromlüks") Sleep(500) Edited Tuesday at 11:58 AM by mustilem23
Nine Posted Tuesday at 12:04 PM Posted Tuesday at 12:04 PM You would need to use WebDriver : 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
ioa747 Posted Tuesday at 12:57 PM Posted Tuesday at 12:57 PM The above method is the correct one However, there is also the beginner's method. ;~ Opt("SendKeyDelay", 100) ; Slow motion ; Open the browser and navigate to the URL Run("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe https://www.trade.gov/data-visualization/csl-search") Local $hWnd = WinWaitActive("CSL Search", "", 5) ; Wait Max 5 sec for the window title If $hWnd Then Send("{TAB 19}") ; go to the name field Send("Kromlüks") ; set the name Send("{TAB 5}") ; go to the search button Send("{ENTER}") ; execute the search Else ConsoleWrite("I can't find the 'CSL Search' window." & @CRLF) EndIf I know that I know nothing
Moderators Melba23 Posted Wednesday at 08:49 AM Moderators Posted Wednesday at 08:49 AM Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
mustilem23 Posted Friday at 12:06 PM Author Posted Friday at 12:06 PM (edited) On 4/22/2025 at 3:57 PM, ioa747 said: Yukarıdaki yöntem doğru olanıdır Ancak, başlangıç yöntemi de vardır. ;~ Opt("SendKeyDelay", 100) ; Slow motion ; Open the browser and navigate to the URL Run("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe https://www.trade.gov/data-visualization/csl-search") Local $hWnd = WinWaitActive("CSL Search", "", 5) ; Wait Max 5 sec for the window title If $hWnd Then Send("{TAB 19}") ; go to the name field Send("Kromlüks") ; set the name Send("{TAB 5}") ; go to the search button Send("{ENTER}") ; execute the search Else ConsoleWrite("I can't find the 'CSL Search' window." & @CRLF) EndIf Thank you very much for your support. I was actually using a similar scenario myself, but in a video I saw that it’s possible to interact with websites using element IDs, which is why I’ve started researching this approach. I don't have much coding knowledge, but as you can see, my current scenario isn’t very complex. I plan to improve and develop it further later on. Edited Friday at 12:06 PM by mustilem23
argumentum Posted Friday at 12:46 PM Posted Friday at 12:46 PM 29 minutes ago, mustilem23 said: in a video I saw that it’s possible to interact with websites using element IDs it may be an old video ? It may not apply to 2025 29 minutes ago, mustilem23 said: don't have much coding knowledge, but as you can see, my current scenario isn’t very complex. yes, and you'll need to use what @nine told you. 31 minutes ago, mustilem23 said: I plan to improve and develop it further later on. ..later on today, this week, as an entry in a bucket list ? I'd personally do what @ioa747 told you ( in code ) and add send Ctrl-A to select all, then Ctrl-C to copy to clipboard the text. Because I never used the WebDriver and this copy and paste is easier to a new coder ( you ). Admittedly the WebDriver is the better approach if you know what you're doing. And seeing what you did on the other thread you show to be very inexperienced, hence this commentary to you. Ok, good luck and have fun SOLVE-SMART 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted Friday at 03:50 PM Posted Friday at 03:50 PM (edited) Here to start you up. This is meant to show you that it is not complicated to accomplish what you want : #include "wd_helper.au3" Local $sDesiredCapabilities = SetupChrome() _WD_Startup() Local $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.trade.gov/data-visualization/csl-search") _WD_FrameEnter($sSession, 0) Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='name']") ConsoleWrite($sElement & @CRLF) _WD_ElementAction($sSession, $sElement, 'value', "Test") ;_WD_DeleteSession($sSession) _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"') Return '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"]}}}}' EndFunc ;==>SetupChrome Edited Friday at 03:52 PM by Nine “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 Friday at 04:37 PM Posted Friday at 04:37 PM 43 minutes ago, Nine said: This is meant to show you that it is not complicated to accomplish what you want As long as @mustilem23 knows all the dependencies of the au3WebDriver (WebDriver) project 🤭 . But yes, you're right (like so often), it's not that complicated as long as the documentation is read and understood. At least for the start. Best regards Sven ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server 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