I'm currently teaching myself how to use Python/Selenium.
I have a block of code that lists all available shirts on a webpage then lists all available colors but I want the shirts/colors to show up together instead of 2 separate lists.
Here's what I've got so far:
shirts = driver.find_elements_by_xpath("""//*[@id="container"]/article/div/h1/a""")
for shirt in shirts:
text = shirt.text
print text
colors = driver.find_elements_by_xpath("""//*[@id="container"]/article/div/p/a""")
for color in colors:
text = color.text
print text
Here's the results of the above code:
Contrast Zip Up Hooded Sweatshirt
Contrast Zip Up Hooded Sweatshirt
Contrast Zip Up Hooded Sweatshirt
Contrast Zip Up Hooded Sweatshirt
Contrast Zip Up Hooded Sweatshirt
Contrast Zip Up Hooded Sweatshirt
Contrast Crewneck
Contrast Crewneck
Contrast Crewneck
Contrast Crewneck
Contrast Crewneck
Contrast Crewneck
Jet Sleeve Zip Up Hooded Sweatshirt
Jet Sleeve Zip Up Hooded Sweatshirt
Jet Sleeve Zip Up Hooded Sweatshirt
Jet Sleeve Zip Up Hooded Sweatshirt
Jet Sleeve Zip Up Hooded Sweatshirt
Navy
Red
Heather Grey
Dark Green
Light Brown
Black
Heather Grey
Light Brown
Black
Dark Green
Red
Navy
Violet
Light Pine
Black
White
Navy