Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions changedetectionio/blueprint/browser_steps/browser_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'Make all child elements visible': '1 0',
'Press Enter': '0 0',
'Select by label': '1 1',
'<select> by option text': '1 1',
'Scroll down': '0 0',
'Uncheck checkbox': '1 0',
'Wait for seconds': '0 1',
Expand Down Expand Up @@ -228,6 +229,15 @@ def click_xy_operation():
except Exception as e:
logger.error(f"Error parsing x,y coordinates: {str(e)}")

def action__select_by_option_text(self, selector, value):
if not selector or not len(selector.strip()):
return

def select_operation():
self.page.select_option(selector, label=value, timeout=self.action_timeout)

self.safe_page_operation(select_operation)

def action_scroll_down(self, selector, value):
def scroll_operation():
# Some sites this doesnt work on for some reason
Expand Down
9 changes: 8 additions & 1 deletion changedetectionio/static/js/browser-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,14 @@ $(document).ready(function () {
$('input[type=text]', first_available).first().val(x['xpath']);
$('input[placeholder="Value"]', first_available).addClass('ok').click().focus();
found_something = true;
} else {
}
else if (x['tagName'] === 'select') {
$('select', first_available).val('<select> by option text').change();
$('input[type=text]', first_available).first().val(x['xpath']);
$('input[placeholder="Value"]', first_available).addClass('ok').click().focus();
found_something = true;
}
else {
// There's no good way (that I know) to find if this
// see https://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node-in-javascript-or-in-debugging
// https://codepen.io/azaslavsky/pen/DEJVWv
Expand Down