This a continuation of a previous post here. In this new post I am trying to capture the contents of the following elements in the HTML code below the following list:
datePosted expected result: "Aug. 18, 2018, 4:19 a.m"
addressCountry expected result: "United States"
addressRegion expected result: "Oklahoma City"
The HTML text is the following:
<div class="container-fluid">
<div itemscope itemtype="http://schema.org/JobPosting">
<div class="row content">
<div class="col-sm-3 sidenav well job_detail_lhs">
<div class="card">
<div class="card-body">
<strong><a href="/?cmp=jd&from=search-more">< Search 32182 More Oil Jobs </a></strong>
<meta itemprop="datePosted" content="Aug. 18, 2018, 4:19 a.m." />
<meta itemprop="industry" content="Oil & Gas" />
<span itemprop="jobLocation" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<h4><strong>Country:</strong></h4>
<p itemprop="addressCountry">United States</p>
<h4><strong>Location:</strong></h4>
<meta itemprop="addressRegion" content="Oklahoma City" />
<p itemprop="addressLocality">Oklahoma City</p>
</span>
</span>
<h4><strong>Posted:</strong></h4>
<p>22 Days Ago</p>
<div>
The web page is: here
...and the code so far is this:
Sub DeepScrap()
Dim IE As New InternetExplorer
Dim Doc As HTMLDocument
Dim sDD As String
Dim i, j, s As Long
s = 5
Sheets("LNK0").Activate
Do Until Cells(s, 1) = ""
'IE.Visible = True
IE.navigate Cells(s, 4)
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Set Doc = IE.document
'The first two elements below come from an upper part of the html,
'I tried different combinations of "getElements" but was not able to
'capture them
htmlTitle = Doc.getElementsByTagName("h1")(0).innerText
htmlCompany = Doc.getElementsByTagName("h3")(0).getElementsByTagName("span")(0).innerText
htmlCountry = 'need to figure out how to get
htmlLoc = 'need to figure out how to get
htmlPost = 'need to figure out how to get
Cells(s, 5) = htmlTitle
Cells(s, 6) = htmlCompany
s = s + 1
Doc.Close
Loop
End Sub
I tried several concatenated combinations of getElementsByTagName but I wasn't able to get the expected results.
Thanks in advance for the help!