有没有办法将已运行的浏览器附加到java中的selenium webdriver? [英] Is there any way to attach an already running browser to selenium webdriver in java?

查看:94
本文介绍了有没有办法将已运行的浏览器附加到java中的selenium webdriver?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我们需要检查Web应用程序是否正在运行以及url是否给出预期结果。

I am developing a application in which we need to check if the web application is running and the url giving the expected results.

我们的调度程序运行此应用程序12次一天。在每次启动时,firefox驱动程序都会被执行,并打开一个新的浏览器窗口来执行操作。

Our Scheduler run this application 12 times a day. In every launch the firefox driver gets executed and a new browser window opens to perform the operations.

我想要一种技术,我们打开firefox浏览器一次并重新使用它每次调用selenium-driver。

I want a technique where we open the firefox browser 1 time and reuse it in every call by selenium-driver.

推荐答案

我实际上并不完全确定你可以切换到不是由驱动程序生成的窗口。我认为参与selenium 2项目的人们已经开始尝试切换到由不同驱动程序生成的窗口。当你这样做:

I am actually not entirely sure you can switch to a window not spawned by the driver. I think the people working on the selenium 2 project have worked a little bit on switching to a window spawned by a different driver. When you do:

driver.getWindowHandles()

所有你得到的是被调用的驱动程序对象产生的窗口。

All you get are the windows spawned by the driver object it is called on.

这是一个非常古老的功能请求:允许webdriver连接到正在运行的浏览器。所以现在不可能。

This is a pretty old feature request: Allow webdriver to attach to a running browser . So it's not possible right now.

这篇关于有没有办法将已运行的浏览器附加到java中的selenium webdriver?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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