UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Clicking On A Tab In Ie, Internet Explorer 8    
 
   
dflak
post May 28 2013, 04:20 PM
Post#1


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


I have a web crawler built in Excel. Heretofore, it worked with our old version of our dashboard. The new version has a couple of wrinkles. At the top level menu when you log in, it has tabs (see picture). In the old version, these tabs were actually links. However they are now defined as a "Tab Container" (whatever that is - please enlighten if you can). I need to know how to find the tab container named "Returns Performance" and click on it.
The following is the code I use for "normal" links
CODE
Public Sub ClickLink(MyLink As String)
Application.StatusBar = "Activating link " & MyLink
        
For Each ieLink In doc.Links
    If ieLink.innertext = MyLink Then
        ieLink.Click
        Exit For
    End If
Next
WaitForIEReady
End Sub

Oput some debugging in this code anr it confirmed that "Returns Performance" is not a normal link name.
Attached File(s)
Attached File  Sceen_Capture.JPG ( 14.52K )Number of downloads: 3
Attached File  Code_Capture.JPG ( 25.59K )Number of downloads: 5
 
Go to the top of the page
 
champagne_charly
post May 28 2013, 04:56 PM
Post#2



Posts: 477
Joined: 31-January 05
From: Blackheath, London


Hi,
You could create a collection of elements with tag td then loop through to find the one where title = "Returns Performance"
Something like this.. (Air code and am very new to using this lib)
CODE
Dim Ell As MSHTML.HTMLHtmlElement
dim coll  As MSHTML.HTMLElementCollection
set Coll = GetElementsByTag("TD")
For each el in Coll
If Ell.title = "Returns PErformance" Then
do something
exit for
end if
Next Ell

Funny I have a similar issue am about to ask help with.. but without the joys of title or UniqueID that can be used.
Go to the top of the page
 
dflak
post May 29 2013, 11:00 AM
Post#3


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


I did a less-than-satisfactory workaround. The tab ID is "dashboard_page_4_tab" so I hardcoded it using getelementbyID.
now have my next probelm. Clicking what appear to be "real" link.
This is the code I am using:
CODE
Public Sub ClickLink(MyLink As String)
Application.StatusBar = "Activating link " & MyLink
On Error Resume Next
For Each ieLink In doc.Links
MsgBox ieLink.innertext
    If ieLink.innertext = MyLink Then
        ieLink.Click
        Exit For
    End If
Next
WaitForIEReady
End Sub

Without the On Error Resume Next, I get an error "Permission Denied" - apparently there are some links on this page I cannot access.
The msgbox statement confirms the the link I am looking for (in this case "Key %'s") exists. However, it is not clicked on.
Attached File(s)
Attached File  Code_Capture2.JPG ( 64.76K )Number of downloads: 1
 
Go to the top of the page
 
dflak
post May 29 2013, 12:11 PM
Post#4


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


I have the contractors who are providing the dashboard look into the permissions issue. In the prior version of the dashboard, I did not have a permissions issue with links, so I did not need an On Error statement. I think this statement is somehow interfering with the link name selection and I wish I had a more elegant way to trap the error.
Go to the top of the page
 
champagne_charly
post May 30 2013, 06:47 AM
Post#5



Posts: 477
Joined: 31-January 05
From: Blackheath, London


Hi,
It which line does the error occur? Is it on click? Is at the time of clicking the page fully loaded? You could try putting a pause in your code. When I got permission denied it was something very simple and a pause did the trick
Regrards
Go to the top of the page
 
champagne_charly
post May 30 2013, 07:00 AM
Post#6



Posts: 477
Joined: 31-January 05
From: Blackheath, London


Could you expand the elements in the pic? or post a little more of the relevant html as code?
Go to the top of the page
 
dflak
post May 30 2013, 07:31 AM
Post#7


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


Promise not to laugh at my primative code? < I keep telling myself that I need to go back and clean this up but real world work in other areas gets in the way.
ithout the On Error Resume Next, the code errors out with "Runtime Error 91: Permission Denied" on this line:
If ieLink.innertext = MyLink Then
Attached are:
- An actual copy of the spreadsheet with the propreitary data (URL, User Name and Login) removed.
- A dump of the developer tool created by F12 for the page in question
- A copy of the source code for the page in question.
I am trying to click on the link "Key %'s"
I have two more links to navigate after that and then I get the to page where I have to play with dropdown boxes. I hope that part still works.
P.S. One more thing - I am working in IE8 because that is what our end customer uses. I can load IE9 on another machine, but I need to keep 8 on my primary machine to test other parts of the dashboard. The dashboard crawler is for our internal use.
Attached File(s)
Attached File  Oracle_BI_Interactive_Dashboards___Dashboard_Home.zip ( 56.59K )Number of downloads: 5
 
Go to the top of the page
 
champagne_charly
post May 30 2013, 11:42 AM
Post#8



Posts: 477
Joined: 31-January 05
From: Blackheath, London


I'm not sure how the link property works however i do not see a href so this is why the error. You have no permission as it doesn't exist.
And your id xxx tab is a table. all be it your tab container..
Maybe one can assume that the clickable link is the 4th descendant of the required ID. And my ignorance of html may be leading you on a wild goose chase...
CODE
<TD class=secondaryTabEnabled title="Returns Performance"><SPAN style="MARGIN-LEFT: 1px; MARGIN-RIGHT: 1px" tabIndex=0>Returns Performance</SPAN></TD>

I was going to pass you a simple function.. unfortunately my app crashed and i hadn't saved it.. gutted! Basically you know it is the 4th descendant of id **** thus want child of child 4 times (i had included siblings if positive)
The function was to pass ID as one variable and a comma seperated string of hierarchy that would then be transformed into an array and the index of the same to be called until UBound. Where + integer would pass it to a sibling and neg to the child. (using case) then using another loop inside it would loop x times (x= abs value of Arr(x)) before going back to get next value in array. Do you get me?
I'll have to recreate myself and pass it to you.
However after looking at this again i personally would go about it the way I sugested the first time. Even if it be a longer process it may be more longterm foolproof and less code. So make a collection of all with tag td getelementswithtag = "TD" and then loop through until title = "returns performance.
COuld I also recomend you use google chrome and the inspect elements. thge work i have done on this the past week i wouldnt have been able to do it without using that functionality..
Regards & good luck
ooh i just noticed.. you have another tag after of name SPAN.. maybe using the second method thats what you shoud make a collection of and not TD..
and another tool I used was Imacro..
Go to the top of the page
 
champagne_charly
post May 30 2013, 03:23 PM
Post#9



Posts: 477
Joined: 31-January 05
From: Blackheath, London


I looked through again and again. and unfortunately my knowledge of html and javascript is too negligable to hel further without see and playing with the site in question.
However the function I mentioned earlier that will find a Descendant of an element with ID "X" is as follows:
called using
CODE
Set MYtbl = HtmlGetIndexDescendant(EllID, htmlDoc, "-3,1,-2")

In this case I am looking for a table so MyTbl is MSHTML.HTMLTable
ANd MyTbl is the (working backwards) 2ndchild of next sibling of 3rd child.
I have in my references MS Internet Controls & MS Html Object Lib. I noticed you had no such references..
Good luck
Go to the top of the page
 
dflak
post May 30 2013, 03:25 PM
Post#10


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


Thanks for the assistance. This looks like it will be shaping up as a weekend project for me.
Go to the top of the page
 
champagne_charly
post Jun 1 2013, 04:23 PM
Post#11



Posts: 477
Joined: 31-January 05
From: Blackheath, London


How you getting on?
Go to the top of the page
 
dflak
post Jun 3 2013, 07:42 AM
Post#12


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


I am seriously thinking of an entirely different approach.
The business requirement is to navigate to a page, select OEMs in turn, within each OEM select models in turn, and then save the resulting report as a PDF file. The PDF files are then concatenated into one big report
Since this is a dashboard, it is run from an Oracle database. I have access to this database. I can query the data I need from that database, and duplicate the report using Excel. I can loop through the OEMs and models, make a page for each model and then save the pages as PDF.
I would still like to crack the code on using the browser. But the newer version seems to be using javascript to place links instead of HTML. I am at a loss and will have to do more research.
Go to the top of the page
 
champagne_charly
post Jun 4 2013, 04:19 AM
Post#13



Posts: 477
Joined: 31-January 05
From: Blackheath, London


Hi,
If you have access to the data directly then it woudl make far more sence to connect directly to the server (i confess that I had wondered about your access ) without any interaction with web whatsoever.
How will you produce the pdf? Can I recommend a process I use? Simply querying your DB using ADO and return xml.. creating XSLT.. convert to XSL-Fo and then use fop to render I have compiled modified version of fop if it can help. In fact you could produce your pdf without concatenating but justy by having different sectio
Go to the top of the page
 
champagne_charly
post Jun 4 2013, 04:22 AM
Post#14



Posts: 477
Joined: 31-January 05
From: Blackheath, London


Also If you do down this path of using FOP. then I would strongly recommend trialling altova stylevision for creating your templates.
Go to the top of the page
 
dflak
post Jun 4 2013, 08:05 AM
Post#15


Utter Access VIP
Posts: 6,016
Joined: 22-June 04
From: North Carolina


My plan of attack is to download the information I need into a series of tables (from multiple Oracle tables to multiple Excel tables). I have a lot of formatting to do to get all these sources into one sheet.
ach model has a three section report: top, middle and bottom. I'll have a template for each part, fill in the data appropriate for the model, copy the data as a picture and position and size it on a destination page. I have to do this because the columns for the top, middle and bottom don't line up and I am trying to make the outcome look like the existing report as much as possible. There is a *lot* of legacy involved with this report and traditions die hard.
I will wind up with one sheet per model. Then the person whose responsibility it is to prepare the report can highlight the pages and publish them as PDF. He then has to go into a third party program to add bookmarks.
Go to the top of the page
 
champagne_charly
post Jun 5 2013, 11:01 AM
Post#16



Posts: 477
Joined: 31-January 05
From: Blackheath, London


Hi, Seems long winded and a bit of a hack but your choice. If you were only able to run a query to obtain XML (in case you dont know how... http://www.dba-oracle.com/t_format_output_html_xml.htm)
When transform with some engine (altova, MS or Saxo) to xsl-fo pass to fop (with xslt) and you have a pdf with all reports. I'd be surprises if you could do an exact copy of weblayout. also If I remember correctly fop http://xmlgraphics.apache.org/fop/quickstartguide.html can do your bookmarks for you too. Its by this method I print my cheques do invoices shipping labels ++++ If you had it in VB6 (only just done my first ever vb6 and its +/- identical to VBA) you could have it as a service and it produce the completed/ reports automatically at specified times without even lifting a finger...
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    13th December 2017 - 07:28 PM