You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Selenium访问旺富网股票页面图表显示undefined的反爬绕过求助

问题:绕过网站的Selenium访问限制以正常加载图表
  • 手动访问某股票资讯页面时,图表可完全正常加载;但通过Selenium访问该页面时,图表无法显示且提示‘undefined’(动态图表区域显示undefined)。
  • 已确认该网站存在针对Selenium的访问限制,现寻求绕过该限制的解决方案。

当前使用的VBA代码

Dim Mychorme As Selenium.ChromeDriver

Sub Take_ScreenShot_Entirepage_Cropped()

    Dim wdh As Integer
    Dim hght As Integer
    Dim topOffset As Integer
    Dim bottomOffset As Integer
    Dim filePath As String
    
    topOffset = 500  ' 
    bottomOffset = 500  ' 
    filePath = ThisWorkbook.Path
    
    Set Mychorme = New Selenium.ChromeDriver
    
    With Mychorme    
        .Timeouts.ImplicitWait = 5000
        .Start
        .Get "https://wantrich.chinatimes.com/tw-market/listed/stock/3167"
                
        wdh = .ExecuteScript("return document.body.scrollWidth")
        hght = .ExecuteScript("return document.body.scrollHeight")  
        .Window.SetSize wdh, hght - topOffset - bottomOffset        
        .ExecuteScript "window.scrollTo(0, " & topOffset & ");"        
        Application.Wait (Now + TimeValue("0:00:03"))        
        .TakeScreenshot.SaveAs filePath & "\screenCapture_Entirepage_Cropped.png"        
        .Quit
        
    End With

End Sub

内容的提问来源于stack exchange,提问作者Hsuan hsien Lin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 03:15:03