All avaible sizes had same class but I need to select by numbers in span. I tried by doing this, but select function dont work with span element.
Code trials:
SIZECHOOSE=Select(driver.find_element(By.CLASS_NAME,"RYghuO._7Cm1F9.dgII7d.pVrzNP"))
SIZECHOOSE.select_by_visible_text("41")
Snapshot of HTML:
CodePudding user response:
As the element is not a html-select element so you won't be able to use the Select()
class.
To click on a any specific number you can use either of the following Locator Strategies:
Using xpath and
normalize-space()
:driver.find_element(By.XPATH, "//span[normalize-space()='42']").click()
Using xpath and
contains()
:driver.find_element(By.XPATH, "//span[contains(., '42')]").click()