V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
uibobo
V2EX  ›  问与答

[求助!]selenium 切换窗口时无法捕获 alert

  •  
  •   uibobo · Nov 16, 2020 · 834 views
    This topic created in 2000 days ago, the information mentioned may be changed or developed.

    场景:点击跳转到新页面,进入新页面时就会弹出一个 alert 。想关闭新页面这个 alert ;

    是不是在执行 switchTo().window 之前这个 alert 已经加载,无法捕获到?

    WebDriver newDriver = driver.switchTo().window(handle);//切换到新的窗口 Alert alert = newDriver.switchTo().alert(); //程序停留在这行 alert.accept();

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5852 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 06:13 · PVG 14:13 · LAX 23:13 · JFK 02:13
    ♥ Do have faith in what you're doing.