There's a button on the webpage that looks like this:
<button class="WAXG WEXG WKKH WOWG WPO" tabindex="0" data-automation-activebutton="true" aria-hidden="false" aria-disabled="false" data-automation-id="wd-ActiveList-addButton" role="button" data-automation-button-type="AUXILIARY" title="Add" type="button"><span class="WFXG WBXG"></span><span class="WCXG" title="Add">Add</span></button>
I use the following code to click on the button:
xpath = "//button[@data-automation-id='wd-ActiveList-addButton']"
add = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, xpath)))
add.click()
It always results in the following error:
selenium.common.exceptions.TimeoutException: Message:
I have tried using different ways to find the element and click, but always get the same error. The button is not inside an iframe. Moreover, I'm able to access/click on all elements around the button. As the error message is empty, I'm clueless as to why this happens.
EDIT
Here's some surrounding code from the inspector:
<div class="WF-M WFN WOYM WEYM" id="wd-SectionView-NO_METADATA_ID">
<div class="WH-M">
<div class="WOO WFN" data-automation-id="activeList" id="wd-ActiveList- 6$87772">
<div class="WHP">
</div>
<button class="WAXG WEXG WKKH WOWG WPO" tabindex="0" data-automation-activebutton="true" aria-hidden="false" aria-disabled="false" data-automation-id="wd-ActiveList-addButton" role="button" data-automation-button-type="AUXILIARY" title="Add" type="button">
<span class="WFXG WBXG"></span>
<span class="WCXG" title="Add">Add</span>
</button>
</div>
</div>
</div>
xpath = "//span[@title='Add']"? There is a chance the button isn't actually visible or has a size of 0. Not very likely given thehtmlhere, but possible. You could also try using devtools or firepath to see what element is highlighted when you put your mouse over the button, as it could actually be an element that contains the button.print(len(driver.find_elements_by_xpath("//button[@data-automation-id='wd-ActiveList-addButton']"))). There might be same hidden buttonxpath = "//span[@title='Add']". Firepath generated the following xpath for the button when I clicked on it:.//*[@id='wd-ActiveList-6$87772']/button.URL?