How can I reconnect to the browser opened by webdriver with selenium?

前端 未结 3 581
暗喜
暗喜 2020-11-21 11:10

For some unknown reasons ,my browser open test pages of my remote server very slowly. So I am thinking if I can reconnect to the browser after quitting the script but don\'t

3条回答
  •  攒了一身酷
    2020-11-21 11:39

    Without getting into why do you think that leaving an open browser windows will solve the problem of being slow, you don't really need a handle to do that. Just keep running the tests without closing the session or, in other words, without calling driver.quit() as you have mentioned yourself. The question here though framework that comes with its own runner? Like Cucumber?

    In any case, you must have some "setup" and "cleanup" code. So what you need to do is to ensure during the "cleanup" phase that the browser is back to its initial state. That means:

    • Blank page is displayed
    • Cookies are erased for the session

提交回复
热议问题