File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 1
1
PublicSession .get_session_id = function (public , private )
2
2
return private .session_id
3
3
end
4
+ PublicSession .close = function (public , private )
5
+ if private .closed then
6
+ return
7
+ end
8
+
9
+ print (" Closing session with ID: " .. private .session_id )
10
+
11
+ -- First, close the WebDriver session
12
+ local result = private .fetch ({
13
+ url = private .url .. " /session/" .. private .session_id ,
14
+ method = " DELETE" ,
15
+ http_version = " 1.1"
16
+ })
17
+ if result .status_code ~= 200 then
18
+ print (" Failed to close session: " .. result .read_body ())
19
+ end
20
+ private .closed = true
21
+ end
4
22
5
23
-- Retorna a quantidade de abas (janelas) abertas na sessão
6
24
PublicSession .get_window_count = function (public , private )
Original file line number Diff line number Diff line change
1
+
1
2
MetaSession .__gc = function (public , private )
2
- print (" Closing session with ID: " .. private .session_id )
3
-
4
- -- First, close the WebDriver session
5
- local result = private .fetch ({
6
- url = private .url .. " /session/" .. private .session_id ,
7
- method = " DELETE" ,
8
- http_version = " 1.1"
9
- })
10
- if result .status_code ~= 200 then
11
- print (" Failed to close session: " .. result .read_body ())
12
- end
3
+ public .close ()
13
4
end
14
5
You can’t perform that action at this time.
0 commit comments