I am writing a script in Python using selenium that automates a store checkout. It launches to the site, finds the first item that matches the criteria, hits checkout, then proceeds top purchase. I am trying to find out how to make it select a specific color. The shop I am buying from updates the store every week with new items, so I won't have the XPATH available to me.
There is a button to change the color, and I need help being able to select the button.
The store has multiple buttons with the product in different colors as a way to choose between them.
The button to change colors has ONE specific attribute titled "data-style-name"="(color)"
I will not have any other attribute, link, or ID known to me, thus searching for this attribute seems like the only way to find it. The picture above is a snippet from pre-existing items on the storepage as an example.
(Note that above it says class="selected" because the "black" jacket has been clicked on while taking this screenshot. Example of a jacket that has not been clicked on:
Anyone have any ideas on the way to go about this?