diff options
Diffstat (limited to '')
-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 |