From 37829003e338d381966d30e6a2e360b8951bd126 Mon Sep 17 00:00:00 2001 From: Crizomb <62544756+Crizomb@users.noreply.github.com> Date: Sat, 8 Apr 2023 19:46:21 +0200 Subject: [PATCH] send msg update now write_message write the msg, send_message click on the button to send it --- chatgpt_code_interface/driver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chatgpt_code_interface/driver.py b/chatgpt_code_interface/driver.py index 0c9afae..8ec69d8 100644 --- a/chatgpt_code_interface/driver.py +++ b/chatgpt_code_interface/driver.py @@ -78,16 +78,17 @@ class GPTDriver: chat = soup.find_all("div", class_="""group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 bg-gray-50 dark:bg-[#444654]""")[-1] return chat - def send_message(self, txt): + def write_message(self, txt): textarea = self.driver.find_element(By.XPATH, '//*[@id="__next"]/div[2]/div[2]/main/div[2]/form/div/div[2]/textarea') better_send_keys(textarea, txt) - time.sleep(1) + + def send_message(self): button_send = self.driver.find_element(By.XPATH, '//*[@id="__next"]/div[2]/div[2]/main/div[2]/form/div/div[2]/button') button_send.click() def add_run_button(self): #html of a big red button with border-radius of 10%, green background and white text pady by 10px up and padx by 10px left - button_html = '' + button_html = '' xpath = """//*[@id="__next"]/div[2]/div[2]/main/div[2]/div/span""" # Find the element using the given XPath