1. 程式人生 > >Selenium裡WebDriver中視窗的close()與quit()

Selenium裡WebDriver中視窗的close()與quit()

查了一下網上的webdreiver 的 api,才發現,

quit()詳細資訊:  “Quits this driver, closing every associated window”,執行這個方法後,driver會關閉所有關聯視窗。

close()詳細資訊:Close the current window, quitting the browser if it's the last window currently open  ,此方法是關閉當前視窗,或最後開啟的視窗。

1. webDriver.Close() - Close the browser window that the driver has focus of //關閉當前焦點所在的視窗


2. webDriver.Quit() - Calls dispose //呼叫dispose方法
3. webDriver.Dispose() Closes all browser windows and safely ends the session 關閉所有視窗,並且安全關閉session