次のhtmlからhref値<a ng-href=
を抽出しようとしています。広告申込情報リストからhref値を抽出します
値 "BJ11TFZ"は動的です。
多くのLIを持つULです。これがリストの最初の項目になります。 私はので、私はli要素のクラス名が一意である場合は、あなたが使用できる
<!-- Begin Results List -->
<ul id="resultsLists" class="o-media-list c-animate c-animate--show" ng-show="rc.results.vehicles.length" style="">
<li id="BJ11TFZ" class="c-animate c-animate--repeat u-pb ng-scope" ng-repeat="car in rc.results.vehicles track by car.registration" style="">
<div class="o-media c-card c-card--hover c-card__block u-p-0 u-shadowed u-shadowed--hover">
<div class="o-media__left o-grid__col-sm-5 o-grid__col-xs-12 u-p-0 u-no-float--sm">
<a ng-href="/used-car/FORD/FIESTA/BJ11TFZ" class="o-embed-responsive o-embed-responsive--16by9 o-media__object c-rollover" ng-click="rc.viewCar(car, $index)" href="/used-car/FORD/FIESTA/BJ11TFZ">
<img ng-src="//images.mycar.com/BJ/11/BJ11TFZ/BJ11TFZ-used-FORD-FIESTA-DIESEL-HATCHBACK-1-6-TDCi-95-Titanium-3dr-Diesel-Manual-RED-2011-HR-S-01.jpg" alt="FORD FIESTA" class="o-embed-responsive__item c-rollover__image" cs-src-responsive="[ [ 'small', '//images.mycar.com/BJ/11/BJ11TFZ/BJ11TFZ-used-FORD-FIESTA-DIESEL-HATCHBACK-1-6-TDCi-95-Titanium-3dr-Diesel-Manual-RED-2011-HR-M-01.jpg' ], [ 'retina', '//images.mycar.com/BJ/11/BJ11TFZ/BJ11TFZ-used-FORD-FIESTA-DIESEL-HATCHBACK-1-6-TDCi-95-Titanium-3dr-Diesel-Manual-RED-2011-HR-M-01.jpg' ] ]" src="//images.mycar.com/BJ/11/BJ11TFZ/BJ11TFZ-used-FORD-FIESTA-DIESEL-HATCHBACK-1-6-TDCi-95-Titanium-3dr-Diesel-Manual-RED-2011-HR-M-01.jpg">
</a>
</div>
<div class="o-media__body o-media--middle c-card">
<label class="c-option c-option--stacked u-pos-t-r u-text-primary u-m-sm u-hidden-print">
<input checklist-value="car.registration" ng-model="checked" class="ng-scope ng-pristine ng-untouched ng-valid" checklist-model="search.savedVehicles" type="checkbox">
<i class="c-option__heart"></i>
<span class="u-text-70">Save</span>
</label>
<div class="c-card__block" ng-click="rc.viewCar(car, $index)">
<strong ng-if="car.vehicleCapDetails.capMakeName != 'MERCEDES-BENZ'" class="ng-binding ng-scope">
FORD FIESTA
</strong>
<div class="u-text-strong u-text-small ng-binding">1.6 TDCi [95] Titanium 3dr, 2011</div>
<div class="u-text-bold u-lh-1 u-pt-sm ng-scope" ng-if="!search.criteria.fromPrice && !search.criteria.toPrice">
<small>From</small> <span class="u-text-125 ng-binding">£114</span> <small>monthly or</small>
<span ng-if="!car.vehiclePrice.exVatPrice" class="ng-binding ng-scope">£5,071</span>
</div>
<div class="u-text-70 u-text-muted u-text-nowrap u-py-sm"> + £149 Admin Fee</div>
<ul class="o-list-inline u-text-70 u-text-muted">
<li class="o-list-inline__item u-pl-0 u-pr-sm">
<span ng-if="car.mileage > 1000" class="ng-binding ng-scope">
67k miles
</span>
</li>
<li class="o-list-inline__item u-pl-0 u-pr-sm ng-binding">
Diesel
</li>
<li class="o-list-inline__item u-pl-0 u-pr-sm ng-binding">
Manual
</li>
<li class="o-list-inline__item u-pl-0 u-pr-sm ng-binding">
Red
</li>
<li class="o-list-inline__item u-pl-0 ng-binding">
<i class="i-icon i-icon--location"></i> Norton<span class="u-text-strong ng-binding ng-scope" ng-if="car.distance">, 2mi</span>
</li>
</ul>
</div>
</div>
</div>
は私が望んでいた正確に何をしたこと、あなたにダビデをありがとうございます。 :-) 私はもう1つのことを私に得ることができます: –
@マークHお手伝いをしてください。この回答または他の誰かがあなたの問題を解決した場合は、受け入れ済みとマークしてください:stackoverflow.com/help/someone-answers他の問題については、別の質問をする必要があります:) –