I am trying to click a button to initiate a file download. The button has hover-over functionality from what I have seen. I have tried clicking via all find_element_by paths.
HTML chunk of the page,
<button class="btn-retrieve ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="sub_1:listPgFrm:j_idt6461:downloadBtn" name="sub_1:listPgFrm:j_idt6461:downloadBtn" onclick="new ice.ace.DataExporter('sub_1:listPgFrm:j_idt6461:downloadBtn', function() { ice.ace.ab(ice.ace.extendAjaxArgs({"source":"sub_1:listPgFrm:j_idt6461:downloadBtn","execute":'@all',"render":'@all',"event":"activate","onstart":function(cfg){showProcessingMessage('Downloading'); return true;;}}, {node:this})); });return false;" style="margin-top: -4px;" role="button" aria-disabled="false"><span class="ui-button-text"><span>Download</span></span></button>
The button's class before hovering is,
"btn-retrieve ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
The button's class when hovering is,
"btn-retrieve ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover"
Selecting the button via the developer window and copying over paths from
<span>Download</span>==$0
I get the following,
CSS path,
#sub_1\:listPgFrm\:j_idt6461\:downloadBtn > span > span
XPath,
//*[@id="sub_1:listPgFrm:j_idt6461:downloadBtn"]/span/span
Code I have tried,
dwnd = driver.find_element_by_xpath("//*[@id='sub_1:listPgFrm:j_idt6461:downloadBtn']/span")
dwnd.click()
And,
button = driver.find_element_by_css_selector("#sub_1\:listPgFrm\:j_idt6461\:downloadBtn")
download = driver.find_element_by_link_text("Download")
hover = ActionChains(driver).move_to_element(button).move_to_element(download)
hover.click().build().perform()