Jump to content

Recommended Posts

Posted (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 by mustilem23
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...