Update Old Selenium Tests
2 direct replies — Read more / Contribute
|
by hbarnard
on Nov 12, 2025 at 04:38
|
I have a fairly substantial, but 'old', set of tests for Cclite. They use, or used use Test::WWW::Selenium; which now doesn't seem to find a webdriver on any version of Selenium that I download
Error requesting http://10.0.0.65:4444/selenium-server/driver/:
404 Not Found
My tests all take the form of
$sel->open_ok("/cgi-bin/cclite.cgi");
$sel->type_ok("registry", 'dalston');
$sel->type_ok("userLogin", $user);
$sel->type_ok("userPassword", "password");
$sel->submit("form") ;
I'd really like to find some way to use/re-use them without too much extra work. I'm prepared to do a little Java and recompile Selenium if it comes to that
|
This is related to my module Crypt::SecretBuffer, where the goal of the module is to prevent leaking secrets into the freed heap memory of the perl process where something could later come along and scan the address space looking for leftover secrets. The SecretBuffer tries to isolate data from being looked at by any normal Perl ops, so that it can be exclusively be viewed by XS/C functions and wiped clean when it goes out of scope.
So, in that context, is there any way to use "pregexec" to apply the perl regex engine to my buffer but prevent it from making copies into perl-owned buffers? pregexec seems a bit under-documented... It says "described in perlreguts" but while that has pages upon pages of the inner workings of the regex engine, it doesn't even tell the meaning of the return value of pregexec or explain exactly what the final "nosave" parameter means. Ideally it would be a flag that does exactly what I want and avoids copying any buffers into any global variables, but that doesn't seem to be the case from looking at the C code. (which I admit I haven't taken the time to fully understand yet)
I'd also be OK if it made copies, but someone could tell me a reliable way to go zero out the buffers of those SVs so that all the captures magically appear to be full of NUL characters afterward.
Basically I'd like it to behave like standard C library regexec that just records positions of the capture groups in an array. I'm also debating if I should just use libc's regexes and declare that limitation on the SecretBuffer API, that you have to restrict yourself to Posix extended regex notation.
Update:
So actually the "nosave" parameter does appear to do some of what I want. Setting that flag prevents any of the magic variables from getting updated.
perl -e 'use v5.40;
use Inline C => q{
int call_pregexec(SV *regex, SV *sv) {
REGEXP *rx= SvRX(regex);
STRLEN len;
char *buf= SvPV(sv, len);
return pregexec(rx, buf, buf+len, buf, 0, sv, 1);
}
};
say "098mnb" =~ /([0-9])([a-z])/;
say call_pregexec(qr/([a-z])([0-9])/, "abc123");
say $&;
say $1; say $2;
say $+[0]; say $+[1];'
but then, the question becomes how to find out *where* the regex matched, since it didn't update any of the output variables.
|