diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-27 16:09:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-27 16:09:21 +0100 |
commit | 0d83bdeef91001c7c00d69f79fccad5a78b4b94b (patch) | |
tree | 362ebeb245cc4e123914635b03f890a314a7a40d /g4f/Provider/selenium/AItianhuSpace.py | |
parent | Merge pull request #1512 from KennyPhan123/patch-1 (diff) | |
parent | Fix PerplexityLabs Provider, Improve bypass_cloudflare helper (diff) | |
download | gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.gz gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.bz2 gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.lz gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.xz gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.zst gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.zip |
Diffstat (limited to 'g4f/Provider/selenium/AItianhuSpace.py')
-rw-r--r-- | g4f/Provider/selenium/AItianhuSpace.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/g4f/Provider/selenium/AItianhuSpace.py b/g4f/Provider/selenium/AItianhuSpace.py index 9878bd5a..4c438e3b 100644 --- a/g4f/Provider/selenium/AItianhuSpace.py +++ b/g4f/Provider/selenium/AItianhuSpace.py @@ -6,7 +6,7 @@ import random from ...typing import CreateResult, Messages from ..base_provider import AbstractProvider from ..helper import format_prompt, get_random_string -from ...webdriver import WebDriver, WebDriverSession +from ...webdriver import WebDriver, WebDriverSession, element_send_text from ... import debug class AItianhuSpace(AbstractProvider): @@ -52,9 +52,9 @@ class AItianhuSpace(AbstractProvider): wait.until(EC.visibility_of_element_located((By.ID, "sheet"))) driver.execute_script(f""" document.getElementById('sheet').addEventListener('click', () => {{ - window.open('{url}', '_blank'); + window.open(arguments[0]); }}); - """) + """, url) driver.find_element(By.ID, "sheet").click() time.sleep(10) @@ -91,8 +91,7 @@ XMLHttpRequest.prototype.open = function(method, url) { driver.execute_script(script) # Submit prompt - driver.find_element(By.CSS_SELECTOR, "textarea.n-input__textarea-el").send_keys(prompt) - driver.find_element(By.CSS_SELECTOR, "button.n-button.n-button--primary-type.n-button--medium-type").click() + element_send_text(driver.find_element(By.CSS_SELECTOR, "textarea.n-input__textarea-el"), prompt) # Read response while True: |