Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

find clickable xpath on a webpage

on below NSE site, I need to click the Download (.csv) button through selenium and I am using below code but its not working-

Site: https://www.nseindia.com/option-chain

Code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

link = driver.find_elements_by_xpath('//*[@id="downloadOCTable"]')
link.click

enter image description here

>Solution :

First of all find_elements_by_xpath returns you a list, what you would need is browser.find_element_by_xpath("//*[@id="downloadOCTable"]").

Store the returned object instance in a variable say element_click.
Then call click on it as

element_click.click()

This should work, or alternatively you can try

link = driver.find_elements_by_xpath('//*[@id="downloadOCTable"]')
link[0].click()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading