Start a new topic
Answered

Portia - CSS selector

Hello,


I need help scraping only the 'sku' id from below element in Portia. Any thoughts on how to do this without changing the code (I'm not a developer)?


<div id="product-details" validation-message="Ikke på lager " not-in-stock="Ikke på lager" class="product-details" ng-init="pCtrl.basketItem.product = {sku: '190758078113', available:118, inBasket:3 }">


I managed to scrape the ng-init, but don't know how to isolate the sku id. I see that Portia has the option of extractors in the annotation - see attached image.


Thanks in advance :)


Chris




Best Answer

Hey Chris,


 '(\d+)'   works if SKU is all numbers. For alphanumeric you can use '(.*?)' .


Regards,

Thriveni Patil

1 Comment

Answer

Hey Chris,


 '(\d+)'   works if SKU is all numbers. For alphanumeric you can use '(.*?)' .


Regards,

Thriveni Patil

Login to post a comment