MyWaitrose
Hacking around with watirose
Getting started
npm install mywaitrose
Typical use case would be to login:
await waitroseAPI;
Then set the delivery postcode (this is required before you try and add anything to your basket)
await waitroseAPI;
You can now search for products:
const products = waitroseAPI;
Add products to your basket:
const newBasket = await waitroseAPI;console;newBasketproducts;
Get the estimated cost of your basket
const newTolleySummary = await waitroseAPI;console;
List the contents of your basket
const itemsInBasket = await waitroseAPI;console;itemsInBasketproducts;
Get your favourite products
const favourites = await waitroseAPI;console;favourites;
Complete example:
; { const waitroseAPI = ; await waitroseAPI; console; // need to set the postcode before we can add stuff to the basket ? await waitroseAPI; console; // see what's in our basket const itemsInBasket = await waitroseAPI; console; itemsInBasketproducts; // get the trolley cost const trolleySummary = await waitroseAPI; console; // seach for a product const products = await waitroseAPI; console; products; // add the first product we found const newBasket = await waitroseAPI; console; newBasketproducts; const newTolleySummary = await waitroseAPI; console;} ;
Development
Setup
Clone the repo and run:
npm install
Running sample code in development
npm run dev USERNAME PASSWORD "POSTCODE" "PRODUCT SEARCH TERM"
This will run the code in a loop waiting for changes to the code. Pass your waitrose username, password, delivery postcode and the product you want to search for.
npm start USERNAME PASSWORD "POSTCODE" "PRODUCT SEARCH TERM"
This will run the code once - pass the same arguments as above.
Building
Build the javascript with:
npm run lint
npm test
npm run compile