Skip to content

Instantly share code, notes, and snippets.

@redgeoff
Created March 2, 2022 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redgeoff/0d3baad1f57a6470dd4d1ae610846eaa to your computer and use it in GitHub Desktop.
Save redgeoff/0d3baad1f57a6470dd4d1ae610846eaa to your computer and use it in GitHub Desktop.
Grocery Shopping Bot: Find and Buy It Again
Find Item And Buy It Again
[Arguments] ${item_name} ${buy_it_again_items}
Go To https://www.safeway.com/shop/search-results.html?q=${item_name}
Load More Items 2
${added_to_cart} ${name_in_store}= Add Found Items With Buy It Again Badge
[Return] ${added_to_cart} ${name_in_store}
Find And Buy It Again
[Arguments] ${items_to_buy} ${buy_it_again_items}
${items_in_cart}= Create List
${items_not_found}= Create List
FOR ${item_to_buy} IN @{items_to_buy}
${added_to_cart} ${name_in_store} Find Item And Buy It Again ${item_to_buy.name} ${buy_it_again_items}
IF '${added_to_cart}'=='True'
Log To Console Found and adding to cart: ${item_to_buy.name} (Name in store: ${name_in_store})
Set To Dictionary ${item_to_buy} name_in_store=${name_in_store}
Append To List ${items_in_cart} ${item_to_buy}
ELSE
Log To Console Not found: ${item_to_buy.name}
Append To List ${items_not_found} ${item_to_buy}
END
END
[Return] ${items_in_cart} ${items_not_found}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment