Home > front end >  I want to download F&O BhavCopy from the below link using Selenium Python
I want to download F&O BhavCopy from the below link using Selenium Python

Time:11-12

https://www1.nseindia.com/products/content/derivatives/equities/archieve_fo.htm

Here after entering the required details, I have tried many times to click on "GetData" button, but Selenium doesn't click on the button. I have tried Below lines of code to click on button but still got no luck.

driver.find_element(By.CSS_SELECTOR,"input[src='/common/images/btn-get-data.gif'][type='image']").click()
driver.find_element(By.XPATH,"//input[@src='/common/images/btn-get-data.gif' and @type='image']").click()
driver.find_element(By.CLASS_NAME,"getdata-button").click()

Here is the element from which I am trying to click on the button,

<input type="image"  src="/common/images/btn-get-data.gif" onclick="validateInput()">

CodePudding user response:

I tried to create a small script for that and I see what you mean. Nothing happens after the click.
I analyzed the behavior and I see that the click happens but for some reason all the requests hang in Pending status.

enter image description here

So, after the click, a request https://www1.nseindia.com/ArchieveSearch?h_filetype=fobhavzip&date=08-11-2022&section=FO is sent but it doesn't return any data. Nothing wrong with your code but I think they somehow detect a "bot" and stop processing all requests from this browser session. You cannot even refresh the page.

CodePudding user response:

Are you using selenium 4?

By documentation doesn't have a class_name method as you seem to be using but a className method

  • Related