如何通过Selenium使用/附加现有的浏览器? [英] How to use/attach an existing browser using Selenium?
本文介绍了如何通过Selenium使用/附加现有的浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Selenium与在Watir中附加现有浏览器等效吗?
What is the Selenium equivalent to attaching an existing browser in Watir?
brw = Watir::IE.attach(:title, "Google")
推荐答案
这是重复的答案 **重新连接到python硒驱动程序** 这适用于所有驱动程序. 1.打开驱动程序
This is a duplicate answer **Reconnect to a driver in python selenium ** This is applicable on all drivers. 1. open a driver
driver = webdriver.Firefox()
2.从驱动程序对象提取到session_id和_url.
2. extract to session_id and _url from driver object.
url = driver.command_executor._url #"http://127.0.0.1:60622/hub"
session_id = driver.session_id #'4e167f26-dc1d-4f51-a207-f761eaf73c31'
3.使用这两个参数连接到您的驱动程序.
3. Use these two parameter to connect to your driver.
driver = webdriver.Remote(command_executor=url,desired_capabilities={})
driver.session_id = session_id
并且您再次连接到驱动程序.
And you are connected to your driver again.
driver.get("http://www.mrsmart.in")
这篇关于如何通过Selenium使用/附加现有的浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文