I am trying to click these buttons with Selenium:
<button class="MuiButtonBase-root MuiButton-root jss38 MuiButton-outlined MuiButton-outlinedPrimary" tabindex="0" type="button"><span class="MuiButton-label">Twist up</span><span class="MuiTouchRipple-root"></span></button>
and
<button class="MuiButtonBase-root MuiButton-root jss38 MuiButton-contained MuiButton-containedPrimary" tabindex="0" type="button"><span class="MuiButton-label">Yes</span><span class="MuiTouchRipple-root"></span></button>
I have tried:
driver.find_element(By.XPATH, "//button[@class='MuiButtonBase-root MuiButton-root jss38 MuiButton-outlined MuiButton-outlinedPrimary']//span[@class='MuiButton-label' and contains('., up')]").click()
and
driver.find_element(By.XPATH, "//button[@class='MuiButtonBase-root MuiButton-root jss38 MuiButton-outlined MuiButton-outlinedPrimary']//span[@class='MuiButton-label' and contains('., Yes')]").click()
I can't do it by the class name, because there are other buttons with the same class name and the static xpath values change, so i'm trying to do it this way but must be missing the gist somewhere.