VBA_Selecting Filter on Site

Pankil

New Member
Joined
Aug 1, 2019
Messages
16
Hello guys,




  • i am working on project where i need vba code to click on "Add Filter", code here looks like -

<div class="select-filter-field no-filters" ng-class="{'no-filters' : currentOptions.length === 0}" ng-click="addFilter()">
<i class="fa fa-fw fa-filter"></i>
Add filter
</div>

event is also there which shows like -

function(e) {
return void 0 !== T && T.event.triggered !== e.type ? T.event.dispatch.apply(t, arguments) : void 0
}



  • after clicking on said "Add filter" small list opens up and i require to click on say 4th item. code is -

<li class="filter-type-option" ng-repeat="field in ::filterFields" ng-click="setFilterField(filter, field)" ng-hide="filterFieldApplied(field.field)">
<i class="fa fa-fw fa-calendar" ng-class="field.icon"></i>
Date
</li>

again event is like -

function(e) {
return void 0 !== T && T.event.triggered !== e.type ? T.event.dispatch.apply(t, arguments) : void 0
}

Thanks in advance........
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,004
Hello

Can you post the page address where the control is or is it a restricted site?
 

Pankil

New Member
Joined
Aug 1, 2019
Messages
16
Hi,

Actually its restricted so not able to share it. can share url but that would be of no help.....
 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,004
Can you post the actual image of the code inspect window for the add filter control, as exemplified below?

 

Pankil

New Member
Joined
Aug 1, 2019
Messages
16
Hi Please see below,
Hope this helps...

 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,004
I cannot see it. You have to upload it to a hosting site and paste a link here, it will display as either a text link or the picture itself, as I did. I am using Imgur to share my images.
Alternatively, you could email it to me.
Considering I cannot test with the actual site, this will increase our chances of success.
 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,004
I can see it now. Please test the code below and report the results:

Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Sub test()
Dim IE As Object, htmlDoc As Object, sURL$, col, cs, cn$
Set IE = CreateObject("internetexplorer.application")
sURL = "http://www.physiofirst.org.uk/find-physio/search-physio.html"   ' your URL here
cn = "form-control mod-text-display"     ' my testing
'cn = "select-filter-field no-filters"   ' use this one, appears to be your class
With IE
    .navigate (sURL)
    .Visible = True
End With
WaitIE IE, 2000
Set htmlDoc = IE.Document
Set col = htmlDoc.getElementsByClassName(cn)
MsgBox col.Length & " elements.", 64
For Each cs In col
    MsgBox cs.Type, 64, "Type"
Next
WaitIE IE, 1000
End Sub


Sub WaitIE(IE As Object, Optional time As Long = 250)
Do
    Sleep time
Loop Until IE.readyState = 4 Or Not IE.Busy
End Sub
 

Pankil

New Member
Joined
Aug 1, 2019
Messages
16
Hey buddy,

thanks for this. i tested the same and getting Run-time error '438' at line - "MsgBox cs.Type, 64, "Type"
 

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,004
How about the first message box? What does it say?
 

Watch MrExcel Video

Forum statistics

Threads
1,102,630
Messages
5,488,004
Members
407,617
Latest member
Samanthad2007

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top