I am using Selenium with Python to automate a process to upload a file. There is an "Upload" button which is disabled by default and only becomes clickable when the file to be uploaded is chosen.
The HTML for Disabled Button is -
<button type="button" id="upload-button" data-bi-id="upload-button" class="ms-Button ms-Button--primary is-disabled root-296" disabled="" aria-label="Upload" aria-disabled="true" data-is-focusable="false">
And the HTML for button after it becomes clickable is -
<button type="button" id="upload-button" data-bi-id="upload-button" class="ms-Button ms-Button--primary root-437" aria-label="Upload" data-is-focusable="true" tabindex="0">
I am using -
WebDriverWait(browser, 15).until(EC.element_to_be_clickable((By.ID,"upload-button"))).click()
But its not working. I believe this is clicking on the disabled button (even though the file is chosen and the button has become clickable). I also tried -
WebDriverWait(browser, 15).until(EC.element_to_be_clickable((By.CLASS_NAME,"ms-Button ms-Button--primary root-437"))).click()
But this gives a TimeOut Exception
. So what should I do to click this button after it becomes clickable. I have tried some solutions from the Internet, but none of them seem to be working.