Skip to content

Commit f0a4df9

Browse files
committed
Update Recorder-parsing of classes and form submissions
1 parent 3531a3e commit f0a4df9

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

seleniumbase/extensions/recorder.zip

-75 Bytes
Binary file not shown.

seleniumbase/js_code/recorder_js.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,12 @@
155155
num_by_attr = [];
156156
child_count_by_attr = [];
157157
for (var i = 0; i < non_id_attributes.length; i++) {
158-
if (non_id_attributes[i] == 'class' && el.hasAttribute('class')) {
159-
class_name = el.getAttribute('class');
160-
if (class_name.length > 0 && !class_name.includes(' ') &&
161-
class_name.includes('-'))
162-
{
163-
selector_by_class = tag_name + '.' + class_name;
164-
all_by_class = document.querySelectorAll(selector_by_class);
165-
if (all_by_class.length == 1)
166-
return selector_by_class;
167-
}
168-
continue;
158+
selector_by_attr[i] = null;
159+
if (non_id_attributes[i] == 'class')
160+
selector_by_attr[i] = selector_by_class;
161+
else {
162+
selector_by_attr[i] = cssPathByAttribute(el, non_id_attributes[i]);
169163
}
170-
selector_by_attr[i] = cssPathByAttribute(el, non_id_attributes[i]);
171164
all_by_attr[i] = document.querySelectorAll(selector_by_attr[i]);
172165
num_by_attr[i] = all_by_attr[i].length;
173166
if (!selector_by_attr[i].includes(child_sep) &&
@@ -646,9 +639,7 @@
646639
if (ra_len > 0 && event.key.toLowerCase() === 'enter' &&
647640
document.recorded_actions[ra_len-1][0] === 'input' &&
648641
document.recorded_actions[ra_len-1][1] === selector &&
649-
!document.recorded_actions[ra_len-1][2].endsWith('\n') &&
650-
document.recorded_actions[ra_len-1][2].length > 0 &&
651-
element.value.length == 0)
642+
!document.recorded_actions[ra_len-1][2].endsWith('\n'))
652643
{
653644
s_text = document.recorded_actions[ra_len-1][2] + '\n';
654645
document.recorded_actions.pop();

0 commit comments

Comments
 (0)