Skip to content

Commit 5d8174b

Browse files
committed
Fix bug with the Recorder in "Assert Text" Mode
1 parent c89f4b6 commit 5d8174b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

seleniumbase/extensions/recorder.zip

10 Bytes
Binary file not shown.

seleniumbase/js_code/recorder_js.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,12 @@
540540
origin = window.location.origin;
541541
sel_has_contains = selector.includes(':contains(');
542542
if (!text) { text = ''; }
543+
text = text.trim();
544+
if (el.tagName.toLowerCase() == "input")
545+
text = el.value.trim();
546+
if (!t_con) { t_con = ''; }
543547
if (rec_mode === '2' || (
544-
rec_mode === '3' && sel_has_contains && text === t_con))
548+
rec_mode === '3' && sel_has_contains && text === t_con.trim()))
545549
{
546550
document.recorded_actions.push(['as_el', selector, origin, d_now]);
547551
json_rec_act = JSON.stringify(document.recorded_actions);
@@ -550,9 +554,6 @@
550554
}
551555
else if (rec_mode === '3') {
552556
action = 'as_et';
553-
text = text.trim();
554-
if (el.tagName.toLowerCase() == "input")
555-
text = el.value.trim();
556557
var match = /\r|\n/.exec(text);
557558
if (match) {
558559
lines = text.split(/\r\n|\r|\n/g);

0 commit comments

Comments
 (0)