I'm using Python Selenium with the Cursor AI tool and I'm trying to write in the search an input of ID but for some reason I only manage to click the search bar but I can't add the input in.
def search_and_verify_lead(self):
"""Search for and verify the created lead"""
try:
print(f"Debug - ID number before search: {self.id_number}")
# Find and click the search button
search_button = self.wait.until(EC.element_to_be_clickable((By.XPATH,
"//button[contains(@class, 'search-button') and @aria-label='Search']")))
search_button.click()
print("Clicked search button")
time.sleep(2)
# Find and interact with search input
input_box = self.wait.until(EC.presence_of_element_located((By.XPATH,
"//input[@title='Search Salesforce']")))
input_box.click()
input_box.clear()
input_box.send_keys(str(self.id_number))
input_box.click()
# Wait for potential dropdown and press RETURN
time.sleep(1)
input_box.send_keys(Keys.RETURN)
print(f"Entered ID {self.id_number} and searched")
time.sleep(3)
except Exception as e:
print(f"Error with search process: {str(e)}")
The element of the search bar I'm trying to add input is:
<button type="button" class="slds-button slds-button_neutral search-button slds-truncate" aria-label="Search" data-aura-rendered-by="275:0"><lightning-primitive-icon variant="bare" data-data-rendering-service-uid="145" data-aura-rendered-by="277:0" lwc-45bd2ao4vb7-host=""><svg focusable="false" aria-hidden="true" viewBox="0 0 520 520" part="icon" lwc-45bd2ao4vb7="" data-key="search" class="slds-button__icon slds-button__icon_left"><g lwc-45bd2ao4vb7=""><path d="M496 453L362 320a189 189 0 10-340-92 190 190 0 00298 135l133 133a14 14 0 0021 0l21-21a17 17 0 001-22zM210 338a129 129 0 11130-130 129 129 0 01-130 130z" lwc-45bd2ao4vb7=""></path></g></svg></lightning-primitive-icon>Search...<!--render facet: 280:0--></button>
when I click on it it changes to this:
<input class="slds-input" part="input" lwc-enmikoh2qu="" autocomplete="off" id="input-306" maxlength="100" placeholder="Search..." type="search" aria-describedby="help-message-306" aria-controls="suggestionsList-301">