1. 程式人生 > >selenium之 關閉視窗close與quit

selenium之 關閉視窗close與quit

selenium關閉視窗有兩個方法,close與quit,我們稍作研究便知道這兩個方法的區別。

看原始碼或API

close

這是close()的說明:

Closes the current window. 

關閉當前視窗。

quit

這是quit()的說明:

Quits the driver and closes every associated window. 

退出驅動並關閉所有關聯的視窗。

從這裡就很明顯的看出來這兩個方法的區別:

  • 一個關閉當前視窗
  • 一個關閉所有視窗