Hy there! I am automating aliexpress with selenium and python where users can buy products at voice command and can purchase any type of product. now the problem is a color and size selection, I have tried x-path but every element have a different x-path for the same color and size, I want a selector for at least four colors and four sizes, for clearance I have given the image, code, and link to the page too. if anyone has the solution plz mention it. thanx in advance
code :
#for selecting color 2 of an third item, but different for every element
elif '2' in query:
try:
color_picker2=driver.find_element_by_xpath('//*[@id="root"]/div/div[2]/div/div[2]/div[7]/div/div[1]/ul/li[2]/div')
color_picker2.click()
except:
color_picker2=driver.find_element_by_xpath('//*[@id="root"]/div/div[2]/div/div[2]/div[6]/div/div/ul/li[2]/div')
color_picker2.click()
link to the page is : https://www.aliexpress.com/item/1005001621523593.html?spm=a2g0o.productlist.0.0.45157741uKKhLZ&algo_pvid=bd6c858e-759b-4c66-a59b-2b1724286123&algo_exp_id=bd6c858e-759b-4c66-a59b-2b1724286123-0