vba scrape by sub division and class - vba

form this html scrap, I just want to get "NO IPLAN PRODUCT - 1" this is only last time under columno4,
<div class="row02">
<div class="column01">
<span class="outputLabel">Originator:</span>
<span class="outputText" id="originator_sessionheader">DORIS M MORRIS - SUBSCRIBER/RECIPIENT</span>
</div>
<div class="column02">
<span class="outputLabel">Tax ID:</span><span class="outputText"></span>
</div>
<div class="column03">
<span class="outputLabel" style="vertical-align: 2px;">PBB
<!-- IE11 remediation changes -->
<img class='imgLink' onclick="openKMWindow('https://svckm.uhc.com/eAgent/iq/ISET/gateway.jsp?create=kb%3AUHG&report()=p[prem_based_ben]');return false;" src="/chap/images/qm_drkBlue.gif" width="13" height="13" alt="PBB KM" title="PBB KM"/>
</span>
<span class="outputText" style="vertical-align: 2px;">:N</span>
</div>
<div class="column04">
<span class="outputLabel style="vertical-align: 2px;">iPlan
<!-- IE11 remediation changes -->
<img class='imgLink' onclick="openKMWindow('https://svckm.uhc.com/eAgent/iq/ISET/gateway.jsp?create=kb%3AUHG&view()=c[i_iplan_ind]');return false;" src="/chap/images/qm_drkBlue.gif" width="13" height="13" alt="IPLAN KM" title="IPLAN KM"/>
</span>
<span class="outputText" style="vertical-align: 2px;cursor:pointer" title="NO IPLAN PRODUCT">:1</span>
I tried multiple vba codes but not getting any solution,

Not quite sure what you're asking but to get the value 1 from the NO IPLAN tag bit you could use this rudimentary text string manipulation that I've recently started to employ as a function due to XML parsing problems:
Sub ho()
Dim str As String
Dim schSTR As String
Dim t1 As Integer
Dim t2 As Integer
Dim t3 As Integer
str = *this is where your HTML scrape would be assigned*
schSTR = "NO IPLAN PRODUCT"">:"
If InStr(1, str, schSTR, vbBinaryCompare) Then
t1 = InStr(1, str, schSTR, vbBinaryCompare) + Len(schSTR)
t2 = InStr(t1, str, "<", vbBinaryCompare)
t3 = t2 - t1
result = Mid(str, t1, t3)
MsgBox result
End If
End Sub
This will give you a message of "1."
If I've understood your requeset properly this will work for any html page/scrape that contains the schSTR variable (in this case "NO IPLAN PRODUCT">:"

Related

Data scraping by selenium p tag

I searched a lot on the internet. I couldn't find an example similar to the one below. I'm trying to pull text from a web page. There is no location line in the first p tag. The second location section has a location line. When pulling data, I can only pull the contents of the p tag, which is the location row. I cannot pull the contents of the other p tag. I wonder how can I pull the data inside the first and second p tag?
HTML codes of Page Source:
<div class=" col-md-8">
<p>
<i class='fa fa-home main-color'></i> ORHAN MAH.İBRAHİM CAD. NO:35
<br>
<i class='fa fa-phone main-color'></i>
<a class="gri" href="tel:0508-2920344">0508-2920344 </a>
<br />
<i class='fa fa-clock-o main-color'></i>
<span class="red">19.01.2022</span>
</p>
<p>
<i class='fa fa-home main-color'></i> HAZAN MAH.ÖKTEM CAD. NO:13/B
<br>
<i class='fa fa-phone main-color'></i>
<a class="gri" href="tel:0584 837 23 70">0584 837 23 70 </a>
<br>
<i class="fa fa-map-marker main-color"></i>
<a class="gri" href="https://www.google.com/maps?q=35.554433,25.887766" target="_blank">Haritada</a>
<br />
<i class='fa fa-clock-o main-color'></i>
<span class="red">20.01.2022</span>
</p>
</div>
Here is the selenium code I used to pull the data from the HTML source above:
item = browser.find_elements_by_class_name("col-md-10")
urls = browser.find_elements_by_xpath("//div[#class=' col-md-10']/p/a[2]")
for i in zip(item,urls):
try:
address = i[0].find_element_by_css_selector("p").text.split("\n")[:2]
except:
address = None
try:
phone = i[0].find_element_by_xpath("//a[#class='gri'][1]").text
except:
phone = None
print(address)
print(phone)
try:
url = i[1].get_attribute('href').replace("https://www.google.com/maps?q=","")
except:
url = None
try:
date = i[0].find_element_by_xpath("//span[#class='red'][1]").text
except:
date = None
print(url)
print(date)
Use xpath //div[#class=' col-md-8']/p. This will return data of both p tags.
Then you can perform string operations as per your requirement and use data of each p tag using for loop
The 1.p tag blog has no location section. The 2.p tag blog has a location section. In the 1.p tag I want, I want to print none instead of the location in the p blog. When I try to pull with zip_longest regularly the location fails to pull.
#1.p tag block
ORHAN MAH.İBRAHİM CAD. NO:35
0508-2920344
19.01.2022
#2.p tag block
HAZAN MAH.ÖKTEM CAD. NO:13/B
0584 837 23 70
Haritada
20.01.2022

Using MSXML2.XMLHTTP in MS Access VBA Returning Blank Body Response

I have an MS Access application that sends a unique identifier to a webpage, and the page is SUPPOSED to respond with First Name, Last Name, and DOB.
This recently broke, and my best trace at root cause is that the request is returning a blank body from the webpage, and our code uses the body to parse out the returned data. No body, no parsing.
There are NO errors as I step through the code. A coworker and I have a combined 3 days fighting with this. We've found the breaking points, but no leads on fixing it.
Here's an outline of what's supposed to happen, and details on where troubleshooting has led us:
On Click of "Lookup Button" on Access form, Validate ID Number Format
Dim sHTML as String
If ValidIDFormat(Me.ID.Value & "") Then
sHTML = GetDOCData(Me.ID.Value)
(I'll spare you the code behind "ValidIDFormat" as that's not the source of the issue)
GetDocData (above) is (I think?) the issue. GetDocData is a function that takes the ID Number and sends it as a request to the webpage as follows:
Public Function GetDOCData(aID As String) As String
Const SUB_NAME As String = "GetDOCData"
On Error GoTo ErrCond
Dim myurl As String
Dim t As Single
Dim TimedOut As Boolean
Dim Tries As Integer
Dim xHTTP As MSXML2.xmlhttp
Set xHTTP = New MSXML2.xmlhttp
myurl = "http://doclookup.com/GCA00P00/WIQ1/WINQ000" 'Upon inspecting the webpage, I found /GCA00P00/WIQ1/WINQ000 corresponds to the webpage's Form Method "Post" Action ( <form method="post" action="/GCA00P00/WIQ1/WINQ000"> )
TryAgain:
xHTTP.Open "POST", myurl, True
xHTTP.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
xHTTP.setRequestHeader "Accept-Encoding", "gzip, deflate"
xHTTP.setRequestHeader "Accept-Language", "en-US,en;q=0.9,ru;q=0.8"
xHTTP.setRequestHeader "Cache-Control", "max-age=0"
xHTTP.setRequestHeader "Content-Length", "213"
xHTTP.setRequestHeader "Host", "doclookup.com"
xHTTP.setRequestHeader "Origin", "http://doclookup.com"
xHTTP.setRequestHeader "Proxy-Connection", "keep-alive"
xHTTP.setRequestHeader "Referer", "http://doclookup.com/GCA00P00/WIQ1/WINQ000"
xHTTP.setRequestHeader "Upgrade-Insecure-Requests", "1"
xHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xHTTP.send "K01=WINQ000&DFH_STATE_TOKEN=&DFH_MAP_STATE_TOKEN=&M00_LAST_NAMEI=&M00_FIRST_NAMEI=&M00_MID_NAMEI=&M00_NAME_SUFXI=&M00_DOBCCYYI=&M00_ID_FLD1I=" & left(aID, 2) & "&M00_ID_FLD2I=" & Mid(aID, 3, 1) & "&M00_ID_FLD3I=" & Right(aID, 4) & "&M00_MISCID_FLD1I=&M00_MISCID_FLD2I="
t = Timer
Tries = 1
Do While (True)
DoEvents
If ((Timer - t) > 5) Then
TimedOut = True
xHTTP.abort
GetDOCData = ""
Exit Do
End If
If (xHTTP.ReadyState = 4) Then
If (xHTTP.Status <> 200) Then
If (Tries < 3) Then
Tries = Tries + 1
xHTTP.abort
GoTo TryAgain
Else
TimedOut = True
xHTTP.abort
GetDOCData = ""
Exit Do
End If
Else
TimedOut = False
GetDOCData = xHTTP.responseText
Debug.Print xHTTP.responseText
Exit Do
End If
End If
DoEvents
Loop
Set xHTTP = Nothing
Exit Function
ErrCond:
EventLogging AppSession.UserName, MSG_TYPE_ERROR, Err.Number, Err.Description, MOD_NAME & "." & SUB_NAME, AppSession.AppSilent
Set xHTTP = Nothing
End Function
Debug.Print output of the response:
<!DOCTYPE html>
<html><head>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>
<meta http-equiv="CacheControl" content="no-cache"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="data:;base64,iVBORw0KGgo="/>
<script>
(function(){
window["bobcmn"] = "11111110101010200000005200000005200000001282ff3ca2200000096300000029application%2fx%2dwww%2dform%2durlencoded300000000300000006/TSPD/300000008TSPD_101300000004http3000000b008f09154e8ab2000c866a39c833f24d99d84e7901aac5a13c0c8ad737654afb25b96b27aba9f9b9008c421cc190a28006d5c954f4b5b362cf850d4f70b2a1ff8e8fcfb526acb91a5740a4c0e36f7d3e7e790a51f2ffbaf98300000107K01%3dWINQ000%26DFH_STATE_TOKEN%3d%26DFH_MAP_STATE_TOKEN%3d%26M00_LAST_NAMEI%3d%26M00_FIRST_NAMEI%3d%26M00_MID_NAMEI%3d%26M00_NAME_SUFXI%3d%26M00_DOBCCYYI%3d%26M00_ID_FLD1I%3d95%26M00_ID_FLD2I%3db%26M00_ID_FLD3I%3d1929%26M00_MISCID_FLD1I%3d%26M00_MISCID_FLD2I%3d200000000";
window.OYm=!!window.OYm;try{(function(){(function(){var S={decrypt:function(S){try{return JSON.parse(function(S){S=S.split("l");var I="";for(var l=0;l<S.length;++l)I+=String.fromCharCode(S[l]);return I}(S))}catch(l){}}};return S={configuration:S.decrypt("123l34l97l99l116l105l118l101l34l58l34l110l111l34l44l34l100l101l98l117l103l103l105l110l103l34l58l34l110l111l34l44l34l109l111l100l117l108l101l49l34l58l34l101l110l97l98l108l101l100l34l44l34l109l111l100l117l108l101l50l34l58l34l101l110l97l98l108l101l100l34l44l34l109l111l100l117l108l101l51l34l58l34l101l110l97l98l108l101l100l34l44l34l109l111l100l117l108l101l52l34l58l34l101l110l97l98l108l101l100l34l125")}})();
var iS=91;try{var JS,LS,OS=_(200)?0:1,ZS=_(567)?0:1,S_=_(300)?0:1;for(var __=(_(912),0);__<LS;++__)OS+=_(989)?1:2,ZS+=(_(404),2),S_+=(_(437),3);JS=OS+ZS+S_;window.jj===JS&&(window.jj=++JS)}catch(i_){window.jj=JS}var o_=!0;function J(S){var I=arguments.length,l=[];for(var Z=1;Z<I;++Z)l.push(arguments[Z]-S);return String.fromCharCode.apply(String,l)}
function z_(S){var I=69;!S||document[L(I,187,174,184,174,167,174,177,174,185,190,152,185,166,185,170)]&&document[J(I,187,174,184,174,167,174,177,174,185,190,152,185,166,185,170)]!==J(I,187,174,184,174,167,177,170)||(o_=!1);return o_}function L(S){var I=arguments.length,l=[],Z=1;while(Z<I)l[Z-1]=arguments[Z++]-S;return String.fromCharCode.apply(String,l)}function _i(){}z_(window[_i[O(1086763,iS)]]===_i);z_(typeof ie9rgb4!==O(1242178186108,iS));
z_(RegExp("\x3c")[O(1372114,iS)](function(){return"\x3c"})&!RegExp(O(42798,iS))[O(1372114,iS)](function(){return"'x3'+'d';"}));
var ii=window[L(iS,188,207,207,188,190,195,160,209,192,201,207)]||RegExp(J(iS,200,202,189,196,215,188,201,191,205,202,196,191),O(-73,iS))[O(1372114,iS)](window["\x6e\x61vi\x67a\x74\x6f\x72"]["\x75\x73e\x72A\x67\x65\x6et"]),ji=+new Date+(_(283)?392128:6E5),Ji,li,si,SI=window[J(iS,206,192,207,175,196,200,192,202,208,207)],iI=ii?_(896)?24437:3E4:_(789)?7473:6E3;
document[L(iS,188,191,191,160,209,192,201,207,167,196,206,207,192,201,192,205)]&&document[L(iS,188,191,191,160,209,192,201,207,167,196,206,207,192,201,192,205)](L(iS,209,196,206,196,189,196,199,196,207,212,190,195,188,201,194,192),function(S){var I=87;document[L(I,205,192,202,192,185,192,195,192,203,208,170,203,184,203,188)]&&(document[J(I,205,192,202,192,185,192,195,192,203,208,170,203,184,203,188)]===O(1058781896,I)&&S[J(I,192,202,171,201,204,202,203,188,187)]?si=!0:document[J(I,205,192,202,192,
185,192,195,192,203,208,170,203,184,203,188)]===L(I,205,192,202,192,185,195,188)&&(Ji=+new Date,si=!1,II()))});function II(){if(!document[J(33,146,150,134,147,154,116,134,141,134,132,149,144,147)])return!0;var S=+new Date;if(S>ji&&(_(848)?582451:6E5)>S-Ji)return z_(!1);var I=z_(li&&!si&&Ji+iI<S);Ji=S;li||(li=!0,SI(function(){li=!1},_(257)?0:1));return I}II();var jI=[_(425)?18598439:17795081,_(80)?2147483647:27611931586,_(166)?1983416588:1558153217];
function JI(S){var I=35;S=typeof S===O(1743045641,I)?S:S[J(I,151,146,118,151,149,140,145,138)](_(696)?24:36);var l=window[S];if(!l[L(I,151,146,118,151,149,140,145,138)])return;var Z=""+l;window[S]=function(S,I){li=!1;return l(S,I)};window[S][J(I,151,146,118,151,149,140,145,138)]=function(){return Z}}for(var LI=(_(728),0);LI<jI[L(iS,199,192,201,194,207,195)];++LI)JI(jI[LI]);z_(!1!==window[J(iS,170,180,200)]);window.IJ={Ll:"08d706d6c9018000e5822dadf90337bb593587216c9ab6a9c485b83578c4437a79e29efc9f34e830ff2af64ab8efa8fb630e6dd1e0826eb0daddd2bd5edfb2a1b1e82309950dfc445dbcd7cec14c66aad4477867c752f7bbeff0a97475a6bb1261632c2feef07f430cba4664d7e896295e4276a6c7e8e1303b350f2e5189a8f59b760816d0b62a13"};function O(S,I){S+=I;return S.toString(36)}
function oI(S){var I=+new Date,l;!document[J(46,159,163,147,160,167,129,147,154,147,145,162,157,160,111,154,154)]||I>ji&&(_(911)?801408:6E5)>I-Ji?l=z_(!1):(l=z_(li&&!si&&Ji+iI<I),Ji=I,li||(li=!0,SI(function(){li=!1},_(609)?0:1)));return!(arguments[S]^l)}function _(S){return 55>S}(function zI(I){I&&"number"!==typeof I||("number"!==typeof I&&(I=1E3),I=Math.max(I,1),setInterval(function(){zI(I-10)},I))})(!0);})();}catch(x){}finally{ie9rgb4=void(0);};function ie9rgb4(a,b){return a>>b>>0};
})();
</script>
<script type="text/javascript" src="/TSPD/08f09154e8ab20002596bec38bbab41a56da7004c2247af39c737e1fdd1f8257d17ddc6579566094?type=10"></script>
<noscript>Please enable JavaScript to view the page content.<br/>Your support ID is: 1436304770756522234.</noscript>
</head><body>
</body></html>
We noticed there is NOTHING returned between the "body" tags in the last 2 lines above ...
I also note the "Please enable JavaScript..." message, before the empty tags. However, if this is the root issue, I'm unaware of how to enable JS in VBA. I tried researching this, and couldn't find anything helpful.
Between #2 and #3 is where the disconnect occurs:
Take webpage response (above) and check if ID that was entered in Access correlates to 1, or multiple records for this person - housed in this website.
If (IsSingleID(sHTML)) Then ' "sHTML" here is the returned string from the webpage response in "GetDocData" Function above
Person = ParseDOCRecord(Me.ID.Value, sHTML)
'sometimes there are multiple returned values - housed in the website - for the person in question. One person can have multiple records, each given a unique ID. There's a different section of code, and different parsing, if multiple records/multiple IDs are returned.
IsSingleID is a Function defined as follows
Public Function IsSingleID(aHTML As String) As Boolean
Const SUB_NAME As String = "IsSingleID"
On Error GoTo ErrCond
Dim doc As New MSHTML.HTMLDocument
Dim o As Variant
IsSingleID = False
doc.Body.innerHTML = aHTML
For Each o In doc.getElementsByTagName("h2")
If (Trim(o.innerText) = "Person Information") Then
IsSingleID = True
Exit For
End If
Next
Set doc = Nothing
Exit Function
ErrCond:
EventLogging AppSession.UserName, MSG_TYPE_ERROR, Err.Number, Err.Description, MOD_NAME & "." & SUB_NAME, AppSession.AppSilent
End Function
The code EXITS here! There is no "o" in in doc.getElementsByTagName("h2")
Could this be because " doc.Body.innerHTML = aHTML " returns a Blank body?
I tried adding a watch to "aHTML" variable to confirm what part(s) of the webpage response (sHTML) is/are sent to "aHTML" variable in above function. But the variable/response was too long for the Watch window.
Regardless, the run never reaches the "ParseDOCRecord" Function in:
If (IsSingleID(sHTML)) Then
Person = ParseDOCRecord(Me.ID.Value, sHTML)
The run EXITS "IsSingleID" function, returns to "Lookup Button" Function (#1), and drops to a 'catch all' kind of message box, hard coded to return:
MsgBox "Unable to get information from DOC site."
I'm scratching my head on this.
Troubleshooting steps we've tried:
We tried updating references to Microsoft XML,v6.0 and using MSXML2.XMLHTTP60 instead. My reasoning was maybe there was a change to the older library that was picked up in the latest version.
Tried removing "/GCA00P00/WIQ1/WINQ000" from the URL, and simply using "doclookup.com"
Tried replacing "h2" tag with "form" tag, in doc.getElementsByTagName("h2") because I noticed I didn't see an "h2" tag in the inspected webpage
Here is the code from Form section of the webpage:
<form method="post" action="/GCA00P00/WIQ1/WINQ000">
<div class="border">
<input type="hidden" name="K01" value="WINQ000">
<input type="hidden" name="DFH_STATE_TOKEN" value="adyqlisv">
<input type="hidden" name="DFH_MAP_STATE_TOKEN" value="">
<div class="pair">
<label for="M00_LAST_NAMEI">Last Name:</label>
<input type="text" size="18" maxlength="18" name="M00_LAST_NAMEI" value="" id="M00_LAST_NAMEI">
</div>
<div class="pair">
<label for="M00_FIRST_NAMEI">First Name:</label>
<input type="text" size="11" maxlength="11" name="M00_FIRST_NAMEI" value="" id="M00_FIRST_NAMEI">
</div>
<div class="pair">
<label for="M00_MID_NAMEI">Middle Init:</label>
<input type="text" size="1" maxlength="1" name="M00_MID_NAMEI" value="" id="M00_MID_NAMEI">
</div>
<div class="pair">
<label for="M00_NAME_SUFXI">Name Suffix:</label>
<input type="text" size="3" maxlength="3" name="M00_NAME_SUFXI" value="" id="M00_NAME_SUFXI"> (SR, JR, etc.)
</div>
<div class="pair">
<label for="M00_DOBCCYYI">Birth Year:</label>
<input type="text" size="4" maxlength="4" name="M00_DOBCCYYI" value="" id="M00_DOBCCYYI"> (Optional, see above)
</div>
<div class="pair">
<label for="M00_DIN_FLD1I">DIN:<span class="hide"> Two digit number
</span></label>
<input type="text" size="2" maxlength="2" name="M00_ID_FLD1I" value="" id="M00_DIN_FLD1I" onfocus="select()" onkeyup="KeyPress(this,event,2,'WINQM00.form.M00_DIN_FLD2I.focus()')">
-
<label for="M00_DIN_FLD2I" class="hide">One character alpha</label>
<input type="text" size="1" maxlength="1" name="M00_ID_FLD2I" value="" id="M00_DIN_FLD2I" onfocus="select()" onkeyup="KeyPress(this,event,1,'WINQM00.form.M00_DIN_FLD3I.focus()')">
-
<label for="M00_DIN_FLD3I" class="hide">Four digit number</label>
<input type="text" size="4" maxlength="4" name="M00_ID_FLD3I" value="" id="M00_DIN_FLD3I" onfocus="select()">
(ID Number, format 99-A-9999, example 95-A-9876)
</div>
<div class="pair">
<label for="M00_NYSID_FLD1I">NYSID:<span class="hide"> Eight digit
number</span></label>
<input type="text" size="8" maxlength="8" name="M00_MISCID_FLD1I" value="" id="M00_MISCID_FLD1I" onfocus="select()" onkeyup="KeyPress(this,event,8,'WINQM00.form.M00_MISCID_FLD2I.focus()')">
-
<label for="M00_MISCID_FLD2I" class="hide">One character alpha</label>
<input type="text" size="1" maxlength="1" name="M00_MISCID_FLD2I" value="" id="M00_MISCID_FLD2I" onfocus="select()">
(For InterDepartmental Use Only; MISC ID Number)
</div>
<div class="aligncenter ">
<input type="submit" value="Submit">
<input type="button" onclick="javascript: location.href = location.href;" value="Reset">
</div>
</div>
</form>
What am I missing?
I hope I've explained this with the right amount of detail...
How can I get this request to return data again?
Follow up based on comments/comment threads below...
I did a search for a record on the website (not one within the application) in order to generate response log from Network tab of webpage. DIN # 18B3079 screenshot of response as follows:

scraping data from websites

How can I get the feedback score using vb? the code I have is only for getelementbyid.
<div class="si-content ">
<h2 class="si-ttl si-trs-ttl">
Seller information
</h2>
<div class="bdg-78">
<div class="mbg">
<a href="http://www.ebay.co.uk/usr/userid5.2.17?_trksid=p2047675.l2559"
aria-label="Member ID: userid5.2.17" id="mbgLink"> <span class="mbg-
nw">userid5.2.17</span></a>
<span class="mbg-l">
(<a href="http://feedback.ebay.co.uk/ws/eBayISAPI.dll? ViewFeedback&userid=userid5.2.17&iid=122504533088&ssPageName=VIP:feedback&ftab=F
eedbackAsSeller&rt=nc&_trksid=p2047675.l2560" title="Feedback score:
15658">15658</a>
<img
alt="Feedback score: 15658"
title="Feedback score: 15658"
src="http://ir.ebaystatic.com/pictures/aw/pics/star-11.gif"">)</span>
</div>
You can use getElementsByTagName to loop through each link. Then you can use getAttribute to check the title attribute for each link. Here's an example...
'Requires a reference (VBE > Tools > Reference) to
'the Microsoft HTML Object Library
Dim HTMLDoc As New MSHTML.HTMLDocument
Dim HTMLLink As MSHTML.IHTMLAnchorElement
HTMLDoc.body.innerHTML = Range("A1").Value
For Each HTMLLink In HTMLDoc.getElementsByTagName("a")
If Left(HTMLLink.getAttribute("title"), 15) = "Feedback score:" Then
MsgBox HTMLLink.innerText, vbInformation
Exit For
End If
Next HTMLLink

Change value in onlick web page option using vba (IE 11)

I'am new in VBA DOM oblject and i'm trying to select a specific option in a web page. Unfortunatly that option has an ID name that is the same as others option in the page except for the value of the inner function.
here the web code:
<table class="stati_check" id="ctl00_NetSiuCPH_ctl25">
<tr>
<td>
<span class="check">
<INPUT onclick="if (!boxWorkflow_rbSelect(this)) return;setTimeout('__doPostBack(\'ctl00$NetSiuCPH$ctl25$ctl00$WorkflowState\',\'\')', 0)" tabIndex=0
id=ctl00_NetSiuCPH_ctl25_ctl00_WorkflowState type=radio
value=ONVALIDAPROOF name=ctl00$NetSiuCPH$ctl25$ctl00$WorkflowState>
</span>
<td>
<span class="check">
<INPUT onclick="if (!boxWorkflow_rbSelect(this)) return;setTimeout('__doPostBack(\'ctl00$NetSiuCPH$ctl25$ctl01$WorkflowState\',\'\')', 0)" tabIndex=0
id=ctl00_NetSiuCPH_ctl25_ctl01_WorkflowState type=radio
value=ONANNULA1 name=ctl00$NetSiuCPH$ctl25$ctl01$WorkflowState>
</span>
</td>
</tr>
</table>
As can be see the two ID are the same so when I run the VBA code line:
Set pdr_button = ie.Document.getElementById("ctl00_NetSiuCPH_ctl25_ctl00_WorkflowState").click
It will be selected only the first option, but i'm trying to select the ones with the value "ONANNULA1".
I've tried with remove/setatribute:
Set Annulla_Button = ie.Document.getElementById("ctl00_NetSiuCPH_ctl25_ctl00_WorkflowState")
Annulla_Button.removeAttribute ("value")
Annulla_Button.setAttribute ("value"), "ONANNULLA1"
Annulla_Button.Click
However the result is that nothing will be selected.
Can someone help me.
thanks in advance for you patience
So that the strip of code:`
Set TABELLA_STATI = ie.Document.getElementById("ctl00_NetSiuCPH_ctl25").getElementsByTagName("TR")
For Each tr In TABELLA_STATI
Set coltd = tr.getElementsByTagName("TD")
For Each td In coltd
Set option_Button = td.getElementsByTagName("INPUT")
Option_Value = option_Button(0).Value
If InStr(1, Option_Value, "ONANNUL") > 0 Then
option_Button(0).Click
Exit For
End If
Next td
Next tr
`

dynamicly build <div> with razor vb.net

Hi i want to dynamicly build a div layout depending on the data i send to view, i want make 2 rows of divs and when there is odd number of models sent to view i want the layout to close as you can see in the code every 2nd model or on last model and start div every odd model .... but when i uncomment the commented code there are errors ....
(if i am not mistaken something similar worked in with C# so i hope it's only synax error)
#For Each procesData In Model
curElement = curElement + 1
elemNumb = elemNumb + 1
If (curElement = 1) Then
'#<div id="row"> !Comented
End If
#<h3>Element number #elemNumb</h3>
#<h3>#procesData.Name</h3>
#<h3>#procesData.Status.ToString</h3>
#<br />
If (curElement = Model.Count) Then
If (elemNumb = 1) Then
'#</div> !comented
End If
End If
If (curElement = 2) Then
'#</div> !comented
elemNumb = 0
End If
Next
I tweaked .css file and i managed to 'avoid' my problem but if anyone knows how to solve this without bypassing the original problem i would be greatfull for answer :)
<div id="toggle">
#For Each procesData In Model
curElement = curElement + 1
elemNumb = elemNumb + 1
Dim idName As String = "element" + elemNumb.ToString
#<div id=#idName>
<div class="heading">
#procesData.Name ::::::: Status <img class="statusIMG" id=#procesData.Status.ToString align="right" src="/" />
</div>
<div class="content">
<p>
Dokladniejsze informacje o wskazniku (potrzebne bedzie id zeby wygenerowac partial view! zapamietac)
<br />
np.Html.ActionLink("Edit Me", "Edit", new { id=item.ID })
</p>
</div>
</div>
If (curElement = 2) Then
elemNumb = 0
End If
Next
</div>