Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
terry3041 committed Dec 14, 2022
1 parent 2f928eb commit 78df950
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyChatGPT"
version = "0.3.9.1"
version = "0.3.9.2"
authors = [
{ name="terry3041", email="[email protected]" },
]
Expand Down
20 changes: 20 additions & 0 deletions src/pyChatGPT/pyChatGPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ def __init_browser(self) -> None:
self.__verbose_print('[init] Did not found one')
pass

# Check if there is an alert
self.__verbose_print('[init] Check if there is alert')
alerts = self.__is_high_demand()
if alerts:
self.__verbose_print('[init] Dismissing alert')
self.driver.execute_script(
"""
var element = document.querySelector('div[role="alert"]');
if (element)
element.parentNode.removeChild(element);
"""
)

def __is_high_demand(self) -> list or None:
'''
Check if there is an alert and close it
'''
alerts = self.driver.find_elements(By.XPATH, '//div[@role="alert"]')
return alerts

def __login(self) -> None:
'''
Login to ChatGPT
Expand Down

0 comments on commit 78df950

Please sign in to comment.