'how do i use send_keys whe a mistake appear s?

i am working on an app to send automated messages via the selenium library, but when i try to use Send_keys or sendKey, it just gives me an error

browser = webdriver.Chrome()
import time
browser.maximize_window()
browser.get("https://web.whatsapp.com/")

with open('contacts.txt','r',encoding="utf8") as f:
    recipient = [ group.strip() for group in f.readlines()]


with open('mensage.txt', 'r', encoding="utf8") as f:
    mensage = [group.strip() for group in f.readlines()]

for group in recipient:
    Search_XPATH = '//div[@contenteditable="true"][@data-tab="3"]'
    Search_box =  WebDriverWait(browser, 500).until
    (EC.presence_of_element_located((By.XPATH, Search_XPATH)))
    Search_box.send_keys(group)

(group is a .txt file that contains a list of contacts)

the error that i am given is

AttributeError: 'function' object has no attribute 'send_keys'


Solution 1:[1]

The issue might be in the break-line, like I see in your code.

try

for group in recipient:
    Search_XPATH = '//div[@contenteditable="true"][@data-tab="3"]'
    Search_box =  WebDriverWait(browser, 500).until(EC.presence_of_element_located((By.XPATH, Search_XPATH)))
    Search_box.send_keys(group)

otherwise looks like you assign a function Search_box = WebDriverWait(browser, 500).until.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Max Daroshchanka