How do I click on buttons with the same classes one by one?
This is the Python code I am using:
clk_but1 = wait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//button[@class = ('applyBtn btn btn-sm btn-red')]")))
driver.execute_script("arguments[0].click();", clk_but1)
clk_but2 = wait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//button[@class = ('applyBtn btn btn-sm btn-red')]")))
driver.execute_script("arguments[0].click();", clk_but2)
The HTML code is as follows:
<div class="daterangepicker dropdown-menu ltr opensright show-calendar"
style="display: block; top: 118px; left: auto; right: 0px;">
...
</div>
<div class="daterangepicker dropdown-menu ltr opensright show-calendar" style="display: none; top: 118px; left: auto; right: 0px;">
...
</div>