Alexander (HH): Automatisches drucken von Packzetteln bei Amazon

Beitrag lesen

Moin Moin!

so ich hab jetzt mal die drei felder markiert und den auswahls quellode rauskopiert...

<td class="data-display-field " style="text-align: center;" valign="top">

<a class="buttonImage" name="Packzettel drucken" href="#"><span class="awesomeButton buttonSmall primarySmallButton inner_button" onclick="return _myoJS_openJSPopupWindow('https://sellercentral.amazon.de/gp/orders-v2/packing-slip?ie=UTF8&amp;orderID=028-1258118-0458717', 750);"><span class="button_label">Packzettel drucken</span></span></a><a class="buttonImage" name="Versand bestätigen" href="https://sellercentral.amazon.de/gp/orders-v2/confirm-shipment?ie=UTF8&amp;orderID=028-1258118-0458717"><span class="awesomeButton buttonSmall primarySmallButton inner_button"><span class="button_label">Versand bestätigen</span></span></a><br><a class="buttonImage" name="Bestellung stornieren" href="https://sellercentral.amazon.de/gp/orders-v2/cancel?ie=UTF8&amp;orderID=028-1258118-0458717"><span class="awesomeButton buttonSmall secondarySmallButton inner_button"><span class="button_label">Bestellung stornieren</span></span></a><br>
        </td>

  
Streichen wir mal den ganzen Styling-Müll:  
~~~html
  
<td>  
  <a name="Packzettel drucken" href="#"><span onclick="return _myoJS_openJSPopupWindow('https://sellercentral.amazon.de/gp/orders-v2/packing-slip?ie=UTF8&amp;orderID=028-1258118-0458717', 750);">Packzettel drucken</span></a>  
  <a name="Versand bestätigen" href="https://sellercentral.amazon.de/gp/orders-v2/confirm-shipment?ie=UTF8&amp;orderID=028-1258118-0458717">Versand bestätigen</a>  
  <a name="Bestellung stornieren" href="https://sellercentral.amazon.de/gp/orders-v2/cancel?ie=UTF8&amp;orderID=028-1258118-0458717">Bestellung stornieren</a>  
</td>  

Zwei einfache Links, einmal offenbar ein Javascript-Popup, dessen erster Parameter ist offenbar die URL des Packzettels. Mit einem HTML-Parser kann man die URLs recht einfach extrahieren, basierend auf den name-Attributen.

Alternative: Browser fernsteuern bzw. Browser-Engine benutzen (ohne Fenster)

http://search.cpan.org/perldoc?WWW::Mechanize::Firefox
http://search.cpan.org/perldoc?Mozilla::Mechanize
http://search.cpan.org/perldoc?Gtk2::WebKit::Mechanize
http://search.cpan.org/perldoc?Win32::IE::Mechanize
http://seleniumhq.org/
http://search.cpan.org/perldoc?WWW::Selenium

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so".