0

I'm attempting to automate a repetitive data-entry task on a webpage. I need to enter text into a series of text fields that appear in a sidebar, which means that I have to

  1. click on the visible text field
  2. send text data from Excel to that text field
  3. click on a button so that the next text field is displayed
  4. repeat 1-3

The problem is that in this particular case I have to log in to the webpage manually, so Excel doesn't have control of the browser, which means that I can't use most of the Selenium commands.

I managed to enter some of the data into different region of the webpage using the AppActivate statement and a series of SendKeys commands:

AppActivate ("Title")

Dim cellValue As Variant
cellValue = Range("B2").Value
SendKeys cellValue, True
SendKeys "{DOWN}"
cellValue = Range("B3").Value
SendKeys cellValue, True
SendKeys "{DOWN}"

I tried to rig up something like this for the text fields mentioned above, but SendKeys won't TAB over to the sidebar (despite the fact that I can TAB over manually).

I don't care at all if the solution is odd or inelegant, as long as it works! I'm new at this, so I may be making obvious mistakes and/or overlooking an obvious solution.

1 Answers1

0

I'm not saying that this is the best possible solution, but it works: I was able to use AutoHotkey to enter the data on the uncontrolled webpage.

^k::
xl :=ComObjActive("Excel.Application")
xl.Range("A1:A10").Copy

CoordMode, Mouse, Screen
Click, 692 939
SendInput %Clipboard%

xl.Range("B1:B10").Copy
Click, 912 289
Sleep 100
Click, 692 917
SendInput %Clipboard%

All it does is click on certain locations and paste data from certain Excel cells based on screen coordinates and Excel range indicators, all triggered by hitting Ctrl + k after starting the AutoHotkey script. Now I need to figure out how to loop it with some sort of built-in variation so that I don't have to copy the second part of the script 100 times, changing the Excel range indicators in each one!