VBA将焦点切换到新窗口

VBA将焦点切换到新窗口

本文介绍了如何使用Selenium VBA将焦点切换到新窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我知道如何找到活动窗口的名称

So, I know how to find the name of the active window

currentWindow = bot.Send("GET", "/window_handle")
bot.SwitchToWindowByName currentWindow

有没有办法获取我刚刚弹出的非活动窗口的名称?

Is there a way to get the name of the inactive window that I just popped up?

我尝试去控制台并输入window.name并得到"还尝试使用window.document.name并获得"download.phtml",但

I tried going to console and typing window.name and got ""Also tried using window.document.name and got "download.phtml", but

bot.SwitchToWindowByName download.phtml

给我一​​个Runtime 424 Object Required错误.

gave me a Runtime 424 Object Required error.

新窗口的图片(在右侧)

推荐答案

明确使用

bot.SwitchToWindowByTitle "Title"  '<==Make sure it is the actual Title you are using of the Window

如果它刚刚弹出,您也可以尝试

If it has just popped up you may also try

bot.SwitchToNextWindow

这篇关于如何使用Selenium VBA将焦点切换到新窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 09:08