Is there a way to keep the browser window open after the test execution in RobotFramework? [closed]

可紊 提交于 2019-12-04 07:01:51

问题


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 !


回答1:


Simple - do not call Close Browser at the end.




回答2:


Ideally, the WebDriver service should stop once your script ends due to this code.

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

Through Selenium-Python client you can:

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/')



回答3:


In a previous Stack Overflow question about connecting to the Chrome remote-debugging-port I provided an example for connecting to a running chrome instance using it's Dev Port.

This will functionally do what you want and as such may be an alternative to no closing as suggested by @Todor and @Bryan.



来源:https://stackoverflow.com/questions/55186282/is-there-a-way-to-keep-the-browser-window-open-after-the-test-execution-in-robot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!