PDA

View Full Version : How to get control of range input type from a webpage using VBA



raj85
01-20-2015, 03:08 AM
Hi Friends,
I am workin on an automation where I have to provide input to a webpage in which a different control I saw which name is range input below is the html code for same.
ONce user change range by dragging mouse one chart get updated.


<div class="range">
<label for="score">scores</label>
<div class="labels">
<span>600</span>
<span class="max">850</span>
</div>
<input style="width: 1px; height: 1px; overflow: hidden; position: absolute; opacity: 0;" id="credit-score" value="700" type="range" step="20" max="840" min="600">
<div id="js-rangeslider-1421669192041" class="rangeslider">
<div style="width: 243.5px;" class="rangeslider__fill"></div>
<div style="left: 232.5px;" class="rangeslider__handle"></div></div>
<div style="left: 223.49px;" id="slider-range" class="range-text">800 - 819
</div>
</div>


I am able to get control of this but some how even after assigning new value it not working and chart is not getting updated :banghead: I am using below code for same.



Set oTab1 = IE.Document.GetElementById("score")
Set oTab = IE.Document.GetElementById("js-rangeslider-1421669192041")

For Each oLink In oTab.all
If InStr(1, oLink.outerhtml, "rangeslider__fill", vbTextCompare) Then


oLink.Style.Width = "150.5px"
ElseIf InStr(1, oLink.outerhtml, "rangeslider__handle", vbTextCompare) Then


oLink.Style.left ="139.5px"
End If
Next
'
IE.Document.GetElementById("slider-range").Style.left = "130.5px"
IE.Document.GetElementById("slider-range").innertext = "720-739"
IE.Document.GetElementById("slider-range").fireevent ("oninput")
oTab1.Value = 720





Please suggest me how I can provide input to range type control.

raj85
01-21-2015, 01:45 AM
I think if I gave website name that would help you to suggest me.
This is the website (http://www.consumerfinance.gov/owning-a-home/check-rates/)

yihu
01-26-2015, 02:47 PM
Hi, I'm not that familiar with the native library that can control IE in VBA.

Have looked at selenium-vba? You'll need to google it as I'm unable to post links on this forum yet. It's a library that allows you to automate web browsing using Firefox/Chrome/IE. Perhaps it's worth a shot.

raj85
01-29-2015, 07:22 AM
Any one has got better solution for this ???
As I can't installed any other software just using VBA I want to complete this.