I tried searching for similar issues on the web but couldnt find an answer for this specific element of the website I am trying to access. A similar approach worked for other elements, hence trying to get some help please.
I would like to download the file located under the Download button there using Selenium in python https://www.sgx.com/derivatives/negotiated-large-trade
The button seems to be located under:
<span class="table-action-label" title="Download" data-i18n="[title]sgx-table.toolbar.action-download;[text]sgx-table.toolbar.action-download" data-i18n-options="{}">Download</span>
My code is
import selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from fake_useragent import UserAgent
ua = UserAgent()
ua_rand = ua.random
print(ua_rand)
dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"] = ua_rand
browser = webdriver.PhantomJS("C://, desired_capabilities=dcap)
browser.get("https://www.sgx.com/derivatives/negotiated-large-trade")
browser.find_element_by_xpath("//span[@class='table-action-label']").click()
browser.quit()
But it doesnt seem to find the element
NoSuchElementException: {"errorMessage":"Unable to find element with xpath '//span[@class='table-action-label']'","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Content-Length":"119","Content-Type":"application/json
How could i download the file?
many thanks