Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select From Search Field #419

Merged
merged 7 commits into from
Sep 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Zoomba/GUILibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,22 @@ def get_react_list_labels(self, locator):
react_select_container = self.find_element(locator)
options = RS.ReactSelect(react_select_container).options()
return [opt.text for opt in options]

@keyword("Select From Search Field")
def select_from_search_field(self, locator, text, timeout=None):
"""This is a Selenium keyword that first attempts to find a web element, clears it, and then inputs text.
Subsequently, it selects the first item in the search dropdown.
If typing into the element fails, the keyword will scroll to the bottom of the page and try again.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really do this? I don't get any indication from the code that this is the case.


locator: (string) A selenium locator(CSS, XPATH, ID, NAME, etc)

text: (string) Text to be typed into the input field.

timeout: (float) Time in seconds to wait, will use global timeout if not set.
"""
self.wait_for_and_focus_on_element(locator, timeout)
self.clear(locator)
self.input_text(locator, text)
self.wait_until_javascript_is_complete()
self.send_keys(Keys.ARROW_DOWN)
self.send_keys(Keys.ENTER)
Loading