0
我是新來的硒,我偶然發現一個錯誤。硒與VB.NET - 找不到元素
我試圖從網站下載一個特定的文件(見代碼),當我到達網站的最後一部分下載鏈接變得可用時,我無法選擇'下載完整證券列表」。我已經嘗試過使用XPath CSS選擇器等等。
你們中的任何一位技術精通的人能否提出一個修正/建議?
任何幫助將是偉大的!
謝謝 吉汗
Sub downloadDBX()
'Initalise Chrome Browser For Execution
Dim driver As IWebDriver
driver = New ChromeDriver("C:\Users\cihan\Documents\Selenium")
'Navigate to the DBx Website
driver.Navigate().GoToUrl("https://etf.deutscheam.com/GBR/ENG/Disclaimer/Institutional")
'Get ElementID to navigate DBX Website
Dim agreeTerms As IWebElement = driver.FindElement(By.XPath("//*[@id='form']/div[3]/div[2]/div[2]/div/div/div[1]/div/div/div/div[2]/div[3]/div[2]/div/div[2]/div[1]/a"))
System.Threading.Thread.Sleep(1000)
agreeTerms.Click()
'Navigate to the equities section of DBx
Dim equitiesPage As IWebElement = driver.FindElement(By.XPath("//*[@id='form']/div[3]/div[2]/div[3]/span[1]/div/div/div[2]/div[3]/div/div[2]/div/ul/li[2]/a"))
System.Threading.Thread.Sleep(1000)
equitiesPage.Click()
'click relevant fund
Dim myFundInformation As IWebElement = driver.FindElement(By.PartialLinkText("ATX UCITS ETF (DR)"))
System.Threading.Thread.Sleep(1000)
myFundInformation.Click()
'change to "ETF Information tab" to gather required data
Dim myFundHoldings As IWebElement = driver.FindElement(By.XPath("//*[@id='ctl02_ctl15_ctl00_ctl01_126']/span"))
System.Threading.Thread.Sleep(1000)
myFundHoldings.Click()
'download my holdings
Dim myData As IWebElement = driver.FindElement(By.XPath("//*[@id='ctl02_ctl15_ctl00_container']div[2]/div[3]/div/div[4]/div[2]/div/a/div[2]/span"))
System.Threading.Thread.Sleep(1000)
myData.Click()
End Sub