Martina
Martina

Reputation: 43

Clicking on a hyper link to download excel file (Selenium Via Python)

I want to be able to click on the hyper link to download a CSV file.

HTML code:

<a class="dxbButton_Office2010Blue XafFileDataAnchor dxbButtonSys" id="Dialog_v7_15797720_MainLayoutView_xaf_l104_xaf_dviFile_View_HA"href="javascript:;"

Selectors Hub:

(//span[contains(text(),'Attachment_Stat')])[2]

//a[@id='Dialog_v14_10076318_MainLayoutView_xaf_l491_xaf_dviFile_View_HA']//span[contains(text(),'Attachment_Stat')]

I tried the below with no success:

driver.find_element(By.XPATH,"//span[contains(@text,'Attachment_Stat')]").click()

Upvotes: 1

Views: 38

Answers (1)

Martina
Martina

Reputation: 43

The below worked for me:

driver.find_element(By.XPATH,"//*[contains(@id,'xaf_dviFile_View_HA')]").click()

Upvotes: 1

Related Questions