diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2023-11-18 03:40:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-18 03:40:09 +0100 |
commit | ca3eaaffee6464adc7f8a6963461a9433be9e7bf (patch) | |
tree | 2f86c8aa7a9db061441712bf60f956ef91a660e9 /g4f/Provider/needs_auth/Bard.py | |
parent | Merge pull request #1262 from hlohaus/any (diff) | |
parent | Improve providers (diff) | |
download | gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.tar gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.tar.gz gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.tar.bz2 gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.tar.lz gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.tar.xz gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.tar.zst gpt4free-ca3eaaffee6464adc7f8a6963461a9433be9e7bf.zip |
Diffstat (limited to 'g4f/Provider/needs_auth/Bard.py')
-rw-r--r-- | g4f/Provider/needs_auth/Bard.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/g4f/Provider/needs_auth/Bard.py b/g4f/Provider/needs_auth/Bard.py index 7f73f1b3..b1df6909 100644 --- a/g4f/Provider/needs_auth/Bard.py +++ b/g4f/Provider/needs_auth/Bard.py @@ -32,7 +32,7 @@ class Bard(BaseProvider): try: driver.get(f"{cls.url}/chat") - wait = WebDriverWait(driver, 10) + wait = WebDriverWait(driver, 10 if headless else 240) wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.ql-editor.textarea"))) except: # Reopen browser for login @@ -61,14 +61,13 @@ XMLHttpRequest.prototype.open = function(method, url) { """ driver.execute_script(script) - # Input and submit prompt + # Submit prompt driver.find_element(By.CSS_SELECTOR, "div.ql-editor.ql-blank.textarea").send_keys(prompt) driver.find_element(By.CSS_SELECTOR, "button.send-button").click() # Yield response - script = "return window._message;" while True: - chunk = driver.execute_script(script) + chunk = driver.execute_script("return window._message;") if chunk: yield chunk return |