同时硒多个标签 [英] Selenium multiple tabs at once

查看:100
本文介绍了同时硒多个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与硒的工作,并想知道是否有可能同时使用多个标签?我不想使用多个浏览器实例(即IE双关语的2份)。如果它是不可能的,怎么会去各个选项卡之间切换,正在运行的顺序?

I'm working with Selenium, and am wondering if it's possible to use multiple TABS at once? I do not want to use multiple browser instances (i.e., 2 copies of IE pun). IF IT IS NOT possible, how would one go about switching between individual tabs, that are running sequentially?

谢谢!

推荐答案

如果有是打开了一个新窗口/标签的链接,那么你可以使用 driver.switchTo()。窗口() ;

If there is a link that opens up a new window/tab, then you can use driver.switchTo().window();

不过,如果你想运行在多个窗口的东西,那么我推荐的webdriver的多个实例。这是很容易管理,并且支持(有上打开一个新标签/窗口的解决方法,比如pressing打开一个新的窗口热键,但他们不支持)。

However, if you want to run something on multiple windows, then I recommend having multiple instances of webdriver. It is much easier to manage, and is supported (There are workarounds on opening a new tab/window, such as pressing a hotkey that opens a new window, but they aren't supported).

如果你想有多个线程在同一驱动程序实例的所有行为,但不同的标签,这是不可能的。

If you are wanting to have multiple threads all act on the same driver instance, but different tabs, that is NOT possible.

这篇关于同时硒多个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆