jimg Posted October 13, 2020 Posted October 13, 2020 (edited) I'm trying to capture text from a certain area on a webpage. I could parse the entire page if necessary. Problem is that AutoItWindowinfo spy can't see anything on the page besides the windows title. If I try WinGetText different browsers yield different info. With Chrome, all I get is "Chrome Legacy Window" With Edge, I get is "Microsoft Edge" and Edge is able to Read Aloud the data, so I'm not sure what the means. With IE, I get a little more, including the Title, the Address, and the title of the tab. If I try to use any of the Developer Tools, the actual data isn't on the page. The actual webpage is a "live" display of some information contained on my Mikrotik router. I'm trying to recognize changes in the display, and store those changes, If there's a character recognition tool, working with bitmaps would be painful, but possible? Edited October 13, 2020 by jimg
Danp2 Posted October 13, 2020 Posted October 13, 2020 Have you tried using the built-in _IE* commands to retrieve the desired text? This will only work with IE of course. For other browsers, your options are either UIAutomation or Webdriver. Latest Webdriver UDF Release Webdriver Wiki FAQs
jimg Posted October 13, 2020 Author Posted October 13, 2020 _IEBodyReadText yields "0". AutoIt is about my paygrade so using UIAutomation or Webdriver looks unlikely, unless the many returns when I google them are all not the ones I'm looking for. It would be easier to take a screen shot every few minutes and manually scan them for changes 🙂
jimg Posted October 13, 2020 Author Posted October 13, 2020 It turns out I can select the text by either Ctrl-A'ing the window or dragging the mouse across the area. I think I can work with that (note "I think").
Danp2 Posted October 14, 2020 Posted October 14, 2020 Did you check the site for frames? Latest Webdriver UDF Release Webdriver Wiki FAQs
jimg Posted October 14, 2020 Author Posted October 14, 2020 (edited) With the developer tools, it looks like there is an iframe but the data I'm trying to see is not within it. I think that Chrome's "View Source" is actually retrieving the initial login page, rather than the page displayed. I'm viewing the page through a VPN connection to the router, so there may be some sort of security lockout. Edited October 14, 2020 by jimg
Danp2 Posted October 14, 2020 Posted October 14, 2020 Does your site use the same interface as http://demo2.mt.lv/webfig/? Latest Webdriver UDF Release Webdriver Wiki FAQs
Danp2 Posted October 15, 2020 Posted October 15, 2020 Ok... so which information are you wanting to capture? Latest Webdriver UDF Release Webdriver Wiki FAQs
jimg Posted October 15, 2020 Author Posted October 15, 2020 The PPP/Active connections. I have a bunch of fixed road warriors, plus my wife, who might connect from a few spots. I'm tired of the brute force attacks on the L2TP open ports, so I want to firewall unknown IPs.
Danp2 Posted October 15, 2020 Posted October 15, 2020 I can't test Active Connections because there aren't any on this demo site. However, this works for the Profiles tab -- #include <IE.au3> #include <Array.au3> $oIE = _IECreate("http://demo2.mt.lv/webfig") Do Sleep(1000) $oElement = _IEGetObjById($oIE, "id_PPP") Until IsObj($oElement) _IEAction($oElement, "click") Sleep(1000) _IELinkClickByText($oIE, "Profiles") ; Change to "Active Connections" Sleep(1000) $oTable = _IETableGetCollection($oIE, 5) $aTableData = _IETableWriteToArray($oTable, True) _ArrayDisplay($aTableData) Change the one line plus the URL and you should be able to test on your own server. Latest Webdriver UDF Release Webdriver Wiki FAQs
jimg Posted October 16, 2020 Author Posted October 16, 2020 My page needs a username:password and I'll need to figure that out when I have a little more time. Thanks for the sample, and I'll let you know if it works.
Danp2 Posted October 16, 2020 Posted October 16, 2020 For now, perform the login manually and change the _IECreate to _IEAttach. jimg 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
jimg Posted October 16, 2020 Author Posted October 16, 2020 I just did a SEND of the password and your script worked perfectly. When you don't use Autoit very often and you get old, your brain obviously atrophies. Thanks very much!
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