I am trying to get href
from a tag using Python + Selenium, but the href
is having "JavaScript"
in it. So I am unable to get the target URL.
I am using Python 3.7.3
, selenium 3.141.0
.
HTML:
<a href="javascript:GoPDF('FS1546')" style="TEXT-DECORATION: Underline">Aberdeen Standard Wholesale Australian Fixed Income</a>
Code:
from selenium import webdriver
driver = webdriver.Chrome("chromedriver.exe")
driver.get("http://www.colonialfirststate.com.au/Price_performance/performanceNPrice.aspx?menutabtype=performance&CompanyCode=001&Public=1&MainGroup=IF&BrandName=FC&ProductIDs=91&Product=FirstChoice+Wholesale+Investments&ACCodes=&ACText=&SearchType=Performance&Multi=False&Hedge=False&IvstType=Investment+products&IvstGroup=&APIR=&FundIDs=&FundName=&FundNames=&SearchProdIDs=&Redirect=1")
print(driver.find_elements_by_xpath("tbody/tr[5]/td[1]/a")
what I need is the target URL
as:
https://www3.colonialfirststate.com.au/content/dam/prospects/fs/1/5/fs1546.pdf?3
but its giving me:
javascript:GoPDF('FS2311')