@@ -59,7 +59,7 @@ def close_browser(self):
59
59
self .info (response .log )
60
60
61
61
@keyword
62
- def new_browser (
62
+ def create_browser (
63
63
self , browser_type = SupportedBrowsers .chromium , ** kwargs ,
64
64
):
65
65
"""Create a new playwright Browser with specified options. A Browser is the Playwright object that controls a single Browser process.
@@ -69,13 +69,13 @@ def new_browser(
69
69
70
70
with self .playwright .grpc_channel () as stub :
71
71
options = json .dumps (kwargs )
72
- response = stub .NewBrowser (
73
- Request ().NewBrowser (browser = browser_type .name , rawOptions = options )
72
+ response = stub .CreateBrowser (
73
+ Request ().Browser (browser = browser_type .name , rawOptions = options )
74
74
)
75
75
self .info (response .log )
76
76
77
77
@keyword
78
- def new_context (
78
+ def create_context (
79
79
self , ** kwargs ,
80
80
):
81
81
"""Create a new BrowserContext with specified options. A BrowserContext is the Playwright object that controls a single browser profile.
@@ -88,33 +88,51 @@ def new_context(
88
88
with self .playwright .grpc_channel () as stub :
89
89
options = json .dumps (kwargs )
90
90
self .info (options )
91
- response = stub .NewContext (Request ().NewContext (rawOptions = options ))
91
+ response = stub .CreateContext (Request ().Context (rawOptions = options ))
92
92
self .info (response .log )
93
93
94
94
@keyword
95
- def new_page (self , url : Optional [str ] = None ):
95
+ def create_page (self , url : Optional [str ] = None ):
96
96
"""Open a new Page. A Page is the Playwright equivalent to a tab.
97
97
98
98
If ``url`` parameter is specified will open the new page to the specified URL.
99
99
"""
100
100
101
101
with self .playwright .grpc_channel () as stub :
102
- response = stub .NewPage (Request ().Url (url = url ))
102
+ response = stub .CreatePage (Request ().Url (url = url ))
103
103
self .info (response .log )
104
104
105
105
@keyword
106
- def switch_active_page (self , index : int ):
106
+ def switch_page (self , index : int ):
107
107
"""Switches the active browser page to another open page by ``index``.
108
108
109
109
Newly opened pages get appended to the end of the list
110
110
"""
111
111
with self .playwright .grpc_channel () as stub :
112
- response = stub .SwitchActivePage (Request ().Index (index = index ))
112
+ response = stub .SwitchPage (Request ().Index (index = index ))
113
113
self .info (response .log )
114
114
115
115
@keyword
116
116
def auto_activate_pages (self ):
117
- """Toggles automatically changing active page to latest opened page """
117
+ """Toggles automatically changing active page to latest opened page. """
118
118
with self .playwright .grpc_channel () as stub :
119
119
response = stub .AutoActivatePages (Request ().Empty ())
120
120
self .info (response .log )
121
+
122
+ @keyword
123
+ def switch_browser (self , index : int ):
124
+ """ UNSTABLE AND NOT USE-READY
125
+
126
+ Switches the currently active Browser to another open Browser.
127
+ """
128
+ with self .playwright .grpc_channel () as stub :
129
+ response = stub .SwitchBrowser (Request ().Index (index = index ))
130
+ self .info (response .log )
131
+
132
+ @keyword
133
+ def switch_context (self , index : int ):
134
+ """ Switches the active BrowserContext to another open context.
135
+ """
136
+ with self .playwright .grpc_channel () as stub :
137
+ response = stub .SwitchContext (Request ().Index (index = index ))
138
+ self .info (response .log )
0 commit comments