是否可以使浏览器窗口保持打开状态

是否可以使浏览器窗口保持打开状态

本文介绍了在RobotFramework中执行测试后,是否可以使浏览器窗口保持打开状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在执行测试后,我仍希望保持浏览器窗口打开.我想无限期地打开它.到目前为止,作为解决方法,我只是使用"Sleep"来防止窗口关闭.

I am looking to keep the browser window open even after test execution.I would like to keep it open indefinitely.As of now , as a work around I am just using "Sleep" to keep the window from closing.

任何帮助将不胜感激.谢谢!

Any help would be much appreciated. Thank you !

推荐答案

理想情况下,由于此代码.

但是,如果您希望之后 Chrome ChromeDriver 保持打开状态,则可以添加实验选项 detach .

However if you want Chrome and ChromeDriver to stay open afterwards, you can add the experimental option detach when initializing the chromedriver.

通过 Selenium-Python 客户端,您可以:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')

这篇关于在RobotFramework中执行测试后,是否可以使浏览器窗口保持打开状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 08:49