I'm aiming to capture data from a page that has been created by the user filling out a form. When I inspect the resultant data it looks like this:
<div class="form-group col-sm-6">
<label for="Mobile_Phone">Mobile phone</label>
So I guess the question is: how can I get the field_value for the label Mobile_Phone (which I will save to a variable).
What web browser are you using?
You need Safari or Google Chrome to use the front-browser actions (at least until KMv9.0 hits the streets).
There are some options available depending upon what browser you're using.
Thanks, @ccstone. That worked, but brings a follow-up question:
There are multiple "field-values" on the page. One for the phone number, one for the email address, one for the date of birth and so on. They're all different by the "label for" identifier. How can I get KM to move from one item to the next, capturing each bit of info into separate variables as it goes?
Also, I'm using Safari.
Something like this?
Change the value in the function call as necessary:
Extract Label Name from Web Page v1.00.kmmacros (6.9 KB)
assisted me in sussing out
the syntax for this.
This is perfect (and gives me much-needed insight on how to select elements from a page). Thanks so much to you and @JMichaelTX for spending your time on this, it's truly appreciated!
But it looks like there are a couple of more elements that I can't quite figure out:
In this one, I'm trying to grab the name "Junior Smith":
<td><a href="/students/446926">Junior Smith</a></td>
In this one, I'm trying to get "Papa Smith":
<div class="row index-title">
<span class="profile-link"><a href="/customers/414346/edit">Edit</a></span>
<span class="pull-right visible-sm visible-xs"><button type="button" class="btn btn-primary btn-xs btn-offcanvas" data-toggle="offcanvas">Info</button></span>
<span class="label label-success pull-right" original-title="Status">Active</span>
<span class="label pull-right label-primary balance-label" original-title="Balance">$0.00</span>
Any further suggestions? I've been hacking away at this myself, to no avail
Try these respectively:
Then parse the output.
You could try
innerHTML instead of
innerText if the text is too hard to parse.
These are a bit more direct:
But they might not work if your web page structure changes any.
Very helpful as always. I think I've got everything working the way I need. Thanks again!