Skip to content

Commit 4d03038

Browse files
Den 291 New_page flag in goto should be called new_tab (#59)
1 parent 4ff92a1 commit 4d03038

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

dendrite_sdk/async_api/_core/dendrite_browser.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,6 @@ async def get_active_page(self) -> AsyncPage:
180180
active_page_manager = await self._get_active_page_manager()
181181
return await active_page_manager.get_active_page()
182182

183-
async def new_page(self) -> AsyncPage:
184-
"""
185-
Opens a new page in the browser.
186-
187-
Returns:
188-
AsyncPage: The newly opened page.
189-
190-
Raises:
191-
Exception: If there is an issue opening a new page.
192-
"""
193-
active_page_manager = await self._get_active_page_manager()
194-
return await active_page_manager.new_page()
195-
196183
async def new_tab(
197184
self,
198185
url: str,
@@ -214,13 +201,13 @@ async def new_tab(
214201
Exception: If there is an error during navigation or if the expected page type is not found.
215202
"""
216203
return await self.goto(
217-
url, new_page=True, timeout=timeout, expected_page=expected_page
204+
url, new_tab=True, timeout=timeout, expected_page=expected_page
218205
)
219206

220207
async def goto(
221208
self,
222209
url: str,
223-
new_page: bool = False,
210+
new_tab: bool = False,
224211
timeout: Optional[float] = 15000,
225212
expected_page: str = "",
226213
) -> AsyncPage:
@@ -229,7 +216,7 @@ async def goto(
229216
230217
Args:
231218
url (str): The URL to navigate to.
232-
new_page (bool, optional): Whether to open the URL in a new page. Defaults to False.
219+
new_tab (bool, optional): Whether to open the URL in a new tab. Defaults to False.
233220
timeout (Optional[float], optional): The maximum time (in milliseconds) to wait for the page to load. Defaults to 15000.
234221
expected_page (str, optional): A description of the expected page type for verification. Defaults to an empty string.
235222
@@ -245,7 +232,7 @@ async def goto(
245232

246233
active_page_manager = await self._get_active_page_manager()
247234

248-
if new_page:
235+
if new_tab:
249236
active_page = await active_page_manager.new_page()
250237
else:
251238
active_page = await active_page_manager.get_active_page()

dendrite_sdk/sync_api/_core/dendrite_browser.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,6 @@ def get_active_page(self) -> Page:
163163
active_page_manager = self._get_active_page_manager()
164164
return active_page_manager.get_active_page()
165165

166-
def new_page(self) -> Page:
167-
"""
168-
Opens a new page in the browser.
169-
170-
Returns:
171-
Page: The newly opened page.
172-
173-
Raises:
174-
Exception: If there is an issue opening a new page.
175-
"""
176-
active_page_manager = self._get_active_page_manager()
177-
return active_page_manager.new_page()
178-
179166
def new_tab(
180167
self, url: str, timeout: Optional[float] = 15000, expected_page: str = ""
181168
) -> Page:
@@ -194,13 +181,13 @@ def new_tab(
194181
Exception: If there is an error during navigation or if the expected page type is not found.
195182
"""
196183
return self.goto(
197-
url, new_page=True, timeout=timeout, expected_page=expected_page
184+
url, new_tab=True, timeout=timeout, expected_page=expected_page
198185
)
199186

200187
def goto(
201188
self,
202189
url: str,
203-
new_page: bool = False,
190+
new_tab: bool = False,
204191
timeout: Optional[float] = 15000,
205192
expected_page: str = "",
206193
) -> Page:
@@ -209,7 +196,7 @@ def goto(
209196
210197
Args:
211198
url (str): The URL to navigate to.
212-
new_page (bool, optional): Whether to open the URL in a new page. Defaults to False.
199+
new_tab (bool, optional): Whether to open the URL in a new tab. Defaults to False.
213200
timeout (Optional[float], optional): The maximum time (in milliseconds) to wait for the page to load. Defaults to 15000.
214201
expected_page (str, optional): A description of the expected page type for verification. Defaults to an empty string.
215202
@@ -222,7 +209,7 @@ def goto(
222209
if not re.match("^\\w+://", url):
223210
url = f"https://{url}"
224211
active_page_manager = self._get_active_page_manager()
225-
if new_page:
212+
if new_tab:
226213
active_page = active_page_manager.new_page()
227214
else:
228215
active_page = active_page_manager.get_active_page()

0 commit comments

Comments
 (0)