I'm building a python script using selenium, and have ran into a quite confusing problem.
The website lists products using a name, which is not unique, and a color, which is not unique either. The color and name elements have the same parent.
My script gets user input on which product he wants the script to buy for him, and which color.
The problem: I can't for the life of me figure out how to select the right product using the two variables productName and productColor.
DOM:
<div class="inner-article">
<h1>
<a class="product-name">Silk Shirt</a>
</h1>
<p>
<a class="product-color">Black</a>
</p>
</div>
What i've tried so far: Obviously, selecting the first product named Silk Shirt on the page is quite easy. I considered selecting the first product, then selecting that products parent, selecting that elements parent, then selecting that parents second child, checking if it was black, and proceeding, but CSS doesn't have a parent selector.
How would i go about doing this?