Skip to content

Commit ad9de83

Browse files
committed
Fix Recorder bugs
1 parent 2280327 commit ad9de83

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

seleniumbase/extensions/recorder.zip

0 Bytes
Binary file not shown.

seleniumbase/js_code/recorder_js.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@
361361
document.title = sessionStorage.getItem('recorder_title');
362362
});
363363
document.body.addEventListener('click', function (event) {
364-
// Do Nothing.
364+
// Do Nothing
365365
});
366366
document.body.addEventListener('submit', function (event) {
367367
reset_if_recorder_undefined();
@@ -513,9 +513,8 @@
513513
if (rec_mode === '2' || rec_mode === '3')
514514
{
515515
el = turnIntoParentAsNeeded(el);
516-
texts = [el.innerText, el.textContent];
517-
text = texts[0];
518-
t_con = texts[1];
516+
text = el.innerText;
517+
t_con = el.textContent;
519518
origin = window.location.origin;
520519
sel_has_contains = selector.includes(':contains(');
521520
if (!text) { text = ''; }
@@ -530,6 +529,8 @@
530529
else if (rec_mode === '3') {
531530
action = 'as_et';
532531
text = text.trim();
532+
if (el.tagName.toLowerCase() == "input")
533+
text = el.value.trim();
533534
var match = /\r|\n/.exec(text);
534535
if (match) {
535536
lines = text.split(/\r\n|\r|\n/g);
@@ -550,7 +551,7 @@
550551
if (ra_len > 0 && document.recorded_actions[ra_len-1][0] === 'mo_dn')
551552
document.recorded_actions.pop();
552553
if (tag_name === 'select') {
553-
// Do Nothing. ('change' action.)
554+
// Do Nothing ('change' action)
554555
}
555556
else
556557
document.recorded_actions.push(['mo_dn', selector, '', d_now]);
@@ -662,7 +663,7 @@
662663
else if (ra_len > 0 &&
663664
document.recorded_actions[ra_len-1][0] === 'mo_dn')
664665
{
665-
// Maybe accidental drag & drop.
666+
// Accidental drag & drop.
666667
document.recorded_actions.pop();
667668
}
668669
json_rec_act = JSON.stringify(document.recorded_actions);
@@ -733,7 +734,7 @@
733734
red_border = 'thick solid #EE3344';
734735
document.querySelector('body').style.border = red_border;
735736
}
736-
// After controls for switching modes.
737+
// After switching modes
737738
if (sessionStorage.getItem('pause_recorder') === 'yes') return;
738739
const d_now = Date.now();
739740
const el = event.target;
@@ -775,7 +776,7 @@
775776
{
776777
skip_input = true;
777778
}
778-
if (!skip_input) {
779+
if (!skip_input && !el.hasAttribute('readonly')) {
779780
document.recorded_actions.push(
780781
['input', selector, el.value, d_now]);
781782
}

0 commit comments

Comments
 (0)