Jump to content

Reading/Manipulating Browser Content from Applications


Recommended Posts

Hi everyone, I am new and learning CA Clarity at my job. I find that there are a lot of repeated actions that is pretty much like cleaning an email box. You click Select All mail on the page, click Delete. You click Select All again, click Delete. And you do that until you've deleted everything...hundreds of items.

I want to try to automate this tedious work and stumbled onto autoit. It looked like it is one of the few tools that can read browser contents.

My problem is that when I view source for the Clarity pages, it is basically empty. An entire page filled with a long list of search results and search option fields only yields the following:

 

Quote

<!doctype html>
<html>
<head>
<meta name="application-name" content="CA Clarity"/>
<meta name="upk-namespace" content="clarity;en"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10"/>
<link rel="SHORTCUT ICON" href="ui/uitk/images/shortcut.ico"/>
<title>General</title>
<link rel="stylesheet" href="ui/uitk/css/clarity.min.css"><script type="text/javascript" src="ui/ext/ext.min.js"></script><script type="text/javascript">require.config({baseUrl: "ui"}); requirejs(["uif/js/clarity_main_min","uif/js/hook" ] );</script>
</head>
<body><div id="ppm_app"></div>
</body>
</html>

Am I basically out of luck?

Thanks in advance.
 

Link to comment
Share on other sites

Yes, it runs on a standard browser. I can use both IE and Chrome, and I'm sure can run on Firefox if I want to.

IE is version 11. I know, it's laughably old. But its source code is the same when I get it from the latest Chrome,  Version 64.0.3282.119

Link to comment
Share on other sites

There are UDFs for all of the mentioned browser. The one for IE is distributed as part of Autoit and is well documented, so I would recommend checking out the _IE functions in the help file. In particular, check out _IEDocReadHTML and _IEBodyReadHTML. Look at the examples and try to adapt to work with the CA product.

Link to comment
Share on other sites

16 hours ago, Danp2 said:

There are UDFs for all of the mentioned browser. The one for IE is distributed as part of Autoit and is well documented, so I would recommend checking out the _IE functions in the help file. In particular, check out _IEDocReadHTML and _IEBodyReadHTML. Look at the examples and try to adapt to work with the CA product.

But as you can see...where are the objects that I can read? I've read the help files and I just don't know what to read. The Window Info tool shows nothing either. I saw a youtube demo that basically showed that a textbox would have a name associated with it, and that the code was simply saying to read the textbox with that name. I don't know what to read to find out which object (check box) to check off.......

Link to comment
Share on other sites

10 hours ago, gruntydatsun said:

if it's only for you and only to click two links, save yourself a lot of effort and just use MouseClick on some coords... then spend the time you would have spent writing code to sip coffee and dunk biscuits.... rapidly starting to slacken off for Straya Day  wooohooO!!!!

Yeah, I think I may have to do this. Is it affected by screen resolution? So I'd have to always use the same monitor? I need to click, scroll, click. Thanks

Link to comment
Share on other sites

6 minutes ago, Danp2 said:

@derpydoos Show us your code where you tried the above.

Quote

 

#include <MsgBoxConstants.au3>
#include <IE.au3>

local $sText

WinActivate("Timesheets")
WinWaitActive("Timesheets")
MsgBox($MB_OK, "Activated window", "OK!")
_IEBodyReadHTML ($sText)

MsgBox($MB_SYSTEMMODAL, "Body Text", $sText)

 

The second msgbox doesn't work and that's where I got stuck. I don't know how to get at the object to manipulate. Thanks.
 

Link to comment
Share on other sites

To start, you need to attach to the existing IE instance. Instead of the Win* commands, use the _IE* command --

$oIE = _IEAttach('Timesheets')

Then use this object reference in the subsequent _IE command --

_IEBodyReadHTML($oIE, $sText)

Read the help file and study the examples for each _IE command. They are there to help you with this stuff. :thumbsup:

Link to comment
Share on other sites

On 1/25/2018 at 9:59 AM, Danp2 said:

To start, you need to attach to the existing IE instance. Instead of the Win* commands, use the _IE* command --

$oIE = _IEAttach('Timesheets')

Then use this object reference in the subsequent _IE command --

_IEBodyReadHTML($oIE, $sText)

Read the help file and study the examples for each _IE command. They are there to help you with this stuff. :thumbsup:

I did the attach and did both the _IEBodyReadHTML($sText) and _IEBodyReadText($sText). I can assure you that I read them before I posted the question, and again after you gave your suggestion.  I did a msgbox of $sText following both commands. Both gave an empty msgbox. Like really, if the info is displayed from the server or whatever and there's nothing, how do I get object references such that I can then manipulate?

Link to comment
Share on other sites

On 1/25/2018 at 8:39 AM, derpydoos said:

Yeah, I think I may have to do this. Is it affected by screen resolution? So I'd have to always use the same monitor? I need to click, scroll, click. Thanks

Yes, it would defiantly be affected by screen resolution. I would suggest you draw your own browser window for this.

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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